Hi,

I guess first off I should let you know I am using a "newer" edition of apache2triad on my winxp. It is using versions php5 and mysql 4. The problem I am having is that a tmp file is not being created.. after using an upload form.

I get this after the form is submitted when I do a print_r to $_FILES
Array
(
[name] => 2 SIDES.jpg
[type] => image/jpeg
[tmp_name] => C:\apache2triad\temp\php88.tmp
[error] => 0
[size] => 188198
)

The problem is that the tmp_name file is never created.. I've tried using the file_exists function to tell.. but I also cannot see it when I go to that directory/folder.

Has anyone else had this problem before or know how to fix it?

Thanks, mike.

    Did you put

    enctype="multipart/form-data"
    

    in your form tag?

      And of course the temporary file is deleted as soon as the script ends (so unless you're really quick you won't see it in a directory listing).

      I would expect file_exists($_FILES['field']['tmp_name']) to return true before that, though.

        This is the form and script that I am using to test, but I am still getting the same exact problem:

        <?xml version="1.0" encoding="iso-8859-1"?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <title>Untitled Document</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        </head>
        
        <body><form enctype="multipart/form-data" action="upload1.php" method="post">
            <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
            Choose a file to upload: <input name="userfile" type="file" />
            <input type="submit" value="Upload File" />
        </form>
        </body>
        </html>
        
        <?php
        $uploadDir = './';
        if(file_exists($_FILES['userfile']['tmp_name']))
        {	
        	print 'file exists';
        }
        $uploadFile = $uploadDir . $_FILES['userfile']['name'];
        print "<pre>";
        if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile))
        {
            print "File is valid, and was successfully uploaded. ";
            print "Here's some more debugging info:\n";
            print_r($_FILES);
        }
        else
        {
            print "Possible file upload attack!  Here's some debugging info:\n";
            print_r($_FILES);
        }
        print "</pre>";
        ?>

        So I don't know whats going on.

          I don't know why, but the script just started working. Hooray!!

          Thanks for the help anyways.

            Write a Reply...