in reply to CGI File upload, resulting files 0 bytes long
Two things - One, always use binmode() when opening files for reading or writing. This dosen't hurt under Unix, and it's certainly necessary under Windows.
The second, and even more important thing, use CGI; ! CGI.pm will make uploading files to your server as easy as :
also including an enforcement of a maximum upload size and many nifty other things. CGI.pm is your friend !# Copy a binary file to somewhere safe open (OUTFILE,">>/usr/local/web/users/feedback"); binmode OUTFILE; while ($bytesread=read($filename,$buffer,1024)) { print OUTFILE $buffer; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: CGI File upload, resulting files 0 bytes long
by myocom (Deacon) on Mar 07, 2001 at 01:51 UTC | |
|
Re: Re: CGI File upload, resulting files 0 bytes long
by sierrathedog04 (Hermit) on Mar 07, 2001 at 04:05 UTC | |
by tye (Sage) on Mar 07, 2001 at 04:20 UTC | |
by sierrathedog04 (Hermit) on Mar 07, 2001 at 04:28 UTC | |
|
Re: Re: CGI File upload, resulting files 0 bytes long
by Mandor (Pilgrim) on Mar 07, 2001 at 02:31 UTC |