CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Temp files with upload script



Mar 23, 2001, 12:48 AM

Post #1 of 1 (553 views)
Temp files with upload script Can't Post

Sorry for the cross post but i'm hoping on more success here then in the Intermediate section
I've written (and borrowed) the following code into my script to allow users to upload images. It works fine but i keep getting a pile of temporary files in the root-dir.
They look like this: 'CGItemp19549' and are a plain copy of the uploaded file. (when i add the right extention it's the uploaded image)
Is there a way to prevent this or do I have to write some code to remove these files automaticly ?

Here are the important bits of the code i use:

use CGI qw/:standard/;
$limit= 20;
$CGI::POST_MAX=1024 * $limit;
open(OUTFILE, ">$dir$file")||&error("Can't open $dir$file. $!");
binmode OUTFILE;
# binmode is for windows only. Ignored by unix
while ($bytesread=read($filename,$buffer,1024))
{print OUTFILE $buffer; }
close (OUTFILE);

Not a big problem...just annoying.


Who is this General Failure and what is he doing on my hard-drive ?


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives