Multipart form data & other form values

Hi!
Can anyone explain me how can i retrive other field values using
multipart form with attached file

for example

···
some field: attach file:

and then

[test.rb]

#!/ruby/bin/ruby
require ‘cgi’

someFile, = cgi[‘attach_file’]
data = someFile.read

how do i get ‘sometext’ value ?
any examples?

thanx.


Andrew “RayZ” V Rumm | Web Developer | rayz@gloria.aaanet.ru | i(Q #620578


Hello,

Why don’t you put a name to this field, like you do in attachfile:

some field:

and read as attach_file

somefield=cgi[‘somefield’].read

bye

···

On Tue 10 Sep 2002 10:21, RayZ wrote:

Hi!
Can anyone explain me how can i retrive other field values using
multipart form with attached file

for example

some field: attach file:

and then

[test.rb]

#!/ruby/bin/ruby
require ‘cgi’

someFile, = cgi[‘attach_file’]
data = someFile.read

how do i get ‘sometext’ value ?
any examples?

thanx.


Andrew “RayZ” V Rumm | Web Developer | rayz@gloria.aaanet.ru | i(Q #620578



Javier Fontan Muiños
jfontan@cesga.es
CESGA, Supercomputing Center of Galicia

sometext = cgi[‘sometext’].to_s

:wink:

RayZ rayz@gloria.aaanet.ru wrote in message news:15514567426.20020910122144@gloria.aaanet.ru

···

Hi!
Can anyone explain me how can i retrive other field values using
multipart form with attached file

for example

some field: attach file:

and then

[test.rb]

#!/ruby/bin/ruby
require ‘cgi’

someFile, = cgi[‘attach_file’]
data = someFile.read

how do i get ‘sometext’ value ?
any examples?

thanx.


Andrew “RayZ” V Rumm | Web Developer | rayz@gloria.aaanet.ru | i(Q #620578


As noted, you need to change the value attribute to a name attribute:

RayZ rayz@gloria.aaanet.ru wrote in message news:15514567426.20020910122144@gloria.aaanet.ru


some field: attach file:

I’d like to point out how narf handles this:

require ‘narf’
Web.process{ |cgi|
someFile = cgi[‘attach_file’] # <= returns Web::Upload
someText = cgi[‘sometext’] # <= returns String
}

Narf is an alternative cgi library. Check out the docs at:

http://narf-lib.sourceforge.net

I’m doing alot of bug fixes / development, so I’d recommend getting
the code via cvs. Instructions are at:

~ Patrick