note 69023 deleted from function.move-uploaded-file by betz
| From: | betz@php.net | Date: | Mon, 21 Aug 2006 23:54:58 +0000 |
| Subject: | note 69023 deleted from function.move-uploaded-file by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116140@lists.php.net to get a copy of this message | ||
Note Submitter: mehdi_n1 at yahoo dot com
----
Hello,
I'v written the next program:
<html>
<head>
<title>Listing 10.12 working on a uploaded file</title>
</head>
<body>
<div>
<?php
if (isset($_FILES['fupload'])){
print "Name: ".$_FILES['fupload']['name']."<br>";
print "Type: ".$_FILES['fupload']['type']."<br>";
print "Temp name:
".$_FILES['fupload']['tmp_name']."<br>";
print "Size: ".$_FILES['fupload']['size']."<br>";
print "Error: ".$_FILES['fupload']['error']."<br>";
if ($_FILES['fupload']['type']=="image/jpeg"){
$source=$_FILES['fupload']['tmp_name'];
$target="upload/".$_FILES['fupload']['name'];
move_uploaded_file ($source, $target);
$size= getImageSize($target);
$imgstr="<p><img width=\"$size[0]\" height=\"$size[1]\"
src=\"$target\" alt=\"uploaded image\">";
print $imgstr;
}
}
?>
</div>
<form enctype="multipart/form-data" action="<?php print
$_SERVER['PHP_SELF'];?>" method="post">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="1000240">
<input type="file" name="fupload"><br>
<input type="submit" value="Upload!">
</p>
</form>
</body>
</html>
but by runnig the program I get this:
Name: 04082006.jpg
Type: image/jpeg
Temp name: /tmp/phpzRj14u
Size: 267302
Error: 0
Warning: move_uploaded_file(upload/04082006.jpg) [function.move-uploaded-file]: failed to open
stream: No such file or directory in /var/www/listing10.12.php on line 20
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move
'/tmp/phpzRj14u' to 'upload/04082006.jpg' in /var/www/listing10.12.php on line
20
Warning: getimagesize(upload/04082006.jpg) [function.getimagesize]: failed to open stream: No such
file or directory in /var/www/listing10.12.php on line 21
uploaded image
Could you tell me what is wrong with my program?
Thanks