|We don't bite newbies here... much|
Re: need help with file uploadingby stephen (Priest)
|on Jun 19, 2001 at 22:39 UTC||Need Help??|
In this code:
You're using single quotes when opening OUTFILE. Therefore, you're always writing to a file named '$filehandle'-- not the contents of the variable, but the string '$filehandle' itself. Change those to double quotes. Better yet, use File::Temp to create a temporary file if you're using 5.6.
Additionally, you should use upload() instead of param() to get the uploaded filehandle for security reasons. Namely, instead of saying:
Since upload() returns undef if there's no upload field with the given name, it'll error out if the user didn't upload a file. More secure, since the user can't try to mess you up by providing a text input to 'filepath'.
Note: Code untested, since I don't have a web server handy.