Read data from enctype="multipart/form-data" form

Hi,

i’m trying to upload a picture on a ruby server. I succeed in it when i
make a form with only the abbility to upload a file.
But the problem is when i try to make a form with additional information
like a textarea.
So my question is, how can i retreive the parameters from a from with
enctype=“multipart/form-data”.

In a normal form i can do like this to retreive the info: numb =
@cgi[“numb”]
But with enctype=“multipart/form-data” it says that numb is stringio or
a file. So how can i get that original data that was in it?

Thanks

Kevin DeValck wrote in post #999235:

But with enctype=“multipart/form-data” it says that numb is stringio or
a file. So how can i get that original data that was in it?

How would you get the contents of a file?

contents = numb.read

How would you read a file line by line?

numb.each do |line|
print line
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs