|Think about Loose Coupling|
Need help with CGI::Uploadby ido50 (Scribe)
|on Jul 29, 2003 at 13:08 UTC||Need Help??|
ido50 has asked for the wisdom of the Perl Monks concerning the following question:
I wanna use CGI::Upload to allow file uploading to the server in a file-manager I wrote. I set up a form (Please note that I don't set up the form using cgi.pm objects, just plain html) like this:
In here $cur is the current working directory, or in other words, the directory to which the file should be uploaded.
Now my problem is that I don't really know how to proccess it to upload the file. I used a little example and wrote this little function:
As you can see my function takes the file, which should be a gif image, and reads the contents of the temp file created by CGI::Upload. After reading the entire file, I create a new image file and print the contents read before into this file. I don't really know much about how image files work so I wasn't sure that this was valid, but I tried anyway.
On testing the script, I get the error "Malformed multipart POST".
I will be much obliged if someone helps me with this problem and guides me through the steps of writing a script that actually uploades a gif file to the server.
20030729 Edit by Corion: Added CODE tags