Having challenge with multipart file upload

Hi:

I am using CGI and webrick to create a file upload facility.

I am using multipart_form from CGI as defined below:

def create_multipart
multipart_form(ENV[“SCRIPT_NAME”]){
’’ +
submit(“Uploadval”,“Uploadname”)
}
end

The problem is reading the data on the server side.
The data comes back as:

params[‘Uploadname’] = Tempfile
params[‘filename’] = Tempfile

What I find strange is that the value of the submit button
is stored in a Tempfile. All I can say is, “Why?”.

However, the real problem I am having is that when I try
to read the data from the file, I get some garbage characters
at the front of the file. This only happens on larger files.
I have not done an exhaustive test, but the few files that
I tried that only had a line or two of data did not have this
problem.

Should I be using CGI#read_multipart? If so, how do I use it.
Also, how do I handle binary files.

Thanks for any help.

···


Jim Freeze