note 91385 rejected from function.rename by danbrown
| From: | danbrown@php.net | Date: | Tue, 09 Jun 2009 16:33:43 +0000 |
| Subject: | note 91385 rejected from function.rename by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156615@lists.php.net to get a copy of this message | ||
Note Submitter: sumariva at gmail dot com
----
I got some trouble with file upload using functions: rename, tmpname.
PHP 5.2.5 is making cache I do not know why since I not called any function related to cache before.
Using the move_uploaded_file does not show the problem with filesize.
Here the example.
if ( $_FILES )
{
$tmp = tempnam( '/tmpdir', 'REN' );
if ( rename( $_FILES['test']['tmp_name'], $tmp ) )
print( 'Done ' );
print( 'Size of file moved: ' ); var_dump( filesize( $tmp ) );
clearstatcache();
print( 'Size of file moved: ' ); var_dump( filesize( $tmp ) );
}
?>
<form method="post" name="renametest"
enctype="multipart/form-data">
<input type="file" name="test">
<input type="submit" name="ok" value="go">
</form>