Not finding uploaded tmp file in upload directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edziffel
Forum Newbie
Posts: 9
Joined: Wed Jul 13, 2011 6:32 am

Not finding uploaded tmp file in upload directory

Post by edziffel »

Am using <form enctptype='multipart/form-data"... as follows:

Code: Select all

    <form enctype="multipart/form-data" name="selectloaddatafileform" action="inldif2.php" method="post">
       <label>Select file to upload in database table ship</label>   
       <input type="file" size="60" name="filetoinsert" />
       <input type="hidden" name="dbselected" value="<?php echo $dbselected;?>" />
       <input type="submit" value="submit" />   
       </form>

On page inldif2.php I get:

Code: Select all

    this is the print r of $ FILES: Array ( [filetoinsert] => Array ( [name] => mytestfort2.csv [type] => text/csv [tmp_name] => /tmp/phpVZvBJw [error] => 0 [size] => 54 ) )
    this is the var dump of $ FILES array(1) { ["filetoinsert"]=> array(5) { ["name"]=> string(15) "mytestfort2.csv" ["type"]=> string(8) "text/csv" ["tmp_name"]=> string(14) "/tmp/phpVZvBJw" ["error"]=> int(0) ["size"]=> int(54) } } 
which is just what was expected.

My upload directory has been set to /tmp, using Ubuntu 10.04 lts.
Running phpinfo() I get

Code: Select all

    upload_tmp_dir   /tmp   /tmp
for local value and master value respectively.

However, after uploading the file from the page where the form is which posts to the page where the print_r and var_dump is parced, I am not seeing the file phpVZvBjw (the temp version as called in the print_r and var_dump) in /tmp. Shouldn't I be able to see the tmp file in the tmp directory?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Not finding uploaded tmp file in upload directory

Post by Celauran »

Best I can tell, this is normal behaviour. Any reason you aren't moving the uploaded file into your site's directory tree?
Post Reply