note 69023 added to function.move-uploaded-file

From: Date: Sun, 20 Aug 2006 10:13:58 +0000
Subject: note 69023 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-116079@lists.php.net to get a copy of this message
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 ---- Server IP: 83.137.20.120 Probable Submitter: 131.174.117.151 ---- X-Spam-Status: No, hits=4.8 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_20_30,HTML_IMAGE_ONLY_12,HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php Edit -- https://master.php.net/note/edit/69023 Del: integrated -- https://master.php.net/note/delete/69023/integrated Del: useless -- https://master.php.net/note/delete/69023/useless Del: bad code -- https://master.php.net/note/delete/69023/bad+code Del: spam -- https://master.php.net/note/delete/69023/spam Del: non-english -- https://master.php.net/note/delete/69023/non-english Del: in docs -- https://master.php.net/note/delete/69023/in+docs Del: other reasons-- https://master.php.net/note/delete/69023 Reject -- https://master.php.net/note/reject/69023 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116079) next »