I think the "How Not to Ask a Question" link is almost a little bit unsuitable in this case because the OP asked a clear question but seems to have been confused by online tutorials that cover PHP rather than Perl.
@Bruce32903, I think the error you got when using the example posted above is most likey due to copying the path given in the example, which will (most likely) not exist on your system. Just change '/usr/local/web/users/feedback' to something that does exist on your system and make sure that you end up with a unique filename. For example, if you can identify your user by a user ID then you might want to write the uploaded file to
'some/path/to/uploaded/files/USER_XXX/feedback'
You only need to understand how to read and write files to the disk. When asked to upload a file, your web server will save the file in a temporary location on your filesystem and all you get from CGI is either a handle on that file (this is the first example in the first reply to your post) or the full name to the temp file (second example).
Once you have that handle, you read from it like you would read from any other file on the disk in a "while (<FILEHANDLE>){..}" loop and you can either write to a new file or jsut do something with the informatin you got and let the system automatically dispose of the tmp file if you don't need to store it.
Just one more thing: if you happen to be on Windows, you might need to add a line
after the "open" statement in the example in the first reply. As far as I know, it doesn't do any harm to put it in just in case anyway.binmode OUTFILE;
In reply to Re^4: File upload under Apache2
by tospo
in thread File upload under Apache2
by Bruce32903
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |