I got this error when i tried to sue the following script:
Warning: stat failed for (errno=2 - No such file or directory) in /home/virtual/site76/fst/var/www/html/iconupload.php on line 9
I don't know what that means! the directory DOES exist and it has all write permissions set to on!
This si the code i use
<?
function move( $old, $new )
{
if( copy( $old, $new ) && unlink( $old ) )
return TRUE;
}
# The file is under 3 KB
if( filesize( $_FILES['file']['tmp_name'] ) < 3000 )
{
$curFile = $_FILES['file']['name'];
$newFile = 'new_' . $_FILES['file']['name'];
# We have managed to rename the file
if( rename( $curFile, $newFile ) )
{
# The extension is either .jpg or .gif
if( ereg( '(.jpg|.gif)$', $newFile ) )
{
# We have managed to move the file to a new path.
if( move( $newFile, '/temp/' . $newFile ) )
{
echo 'Yes!';
} else { echo "Error: Could not move file."; }
} else { echo "Error: File is not of correct extension"; }
} else { echo "Error: Could not rename file"; }
}
?>