in reply to filehandles being recorded as CGItemp files

It looks like CGI uses your current directory as the directory for temporary files, likely because it can't find any other directory it can use. See the source of that module, the sub find_tempdir, how it tries to find a directory.

Why? No idea. Maybe it's because you're running your script under taint mode.

Anyway, take a look at this line in CGI.pm:

# HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES. # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING. # $CGITempFile::TMPDIRECTORY = '/usr/tmp';
That would certainly fix it.

Replies are listed 'Best First'.
Re^2: filehandles being recorded as CGItemp files
by Andre_br (Pilgrim) on May 02, 2006 at 17:09 UTC
    Hello Bart and Ahmad

    It was weird that this started happening now, as I could swear it didn´t before, with the same code. But I just could solve it by closing the filehandle of the uploaded file, like this:

    ... close PHOTO; close $photocover;
    Now the file still gets created at my scripts dir, but is deleted right away, when I close the handle.

    But anyway, thanks a lot for the ideas.

    André