sodascape Posted November 25, 2006 Share Posted November 25, 2006 [b]What is wrong with this script? It keeps spitting out, "Your File Could NOt Be Uplaoded Because: [/b][code] <?php // IMAGE UPLOAD FUNCTION function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth) { $srcImg = imagecreatefromjpeg("$imageDirectory/$imageName"); $origWidth = imagesx($srcImg); $origHeight = imagesy($srcImg); $ratio = $thumbWidth / $origWidth; $thumbHeight = $origHeight * $ratio; $thumbImg = imagecreatetruecolor($thumbWidth, $thumbHeight); imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $origWidth, $origHeight); imagejpeg($thumbImg, "$thumbDirectory/$imageName"); } // END IMAGE UPLOAD FUNCTION $done = 'false'; if (isset($_POST['upload'])) { // IMAGE UPLOAD if (move_uploaded_file ($_FILES['picture1']['tmp_name'], "picpost/{$_FILES['picture1']['name']}")) { } else { echo '<p>Your file could not be uploaded because:</p>'; switch ($_FILES['picture1']['error']) { case 1: echo 'Your file is bigger than what the server can hold!'; break; case 2: echo 'Your file is too big!'; break; case 3: echo 'Only part of the file was uploaded!'; break; case 4: echo 'No file was uploaded.'; break; } exit(); }// End If Move Uploaded File $fileName = $_FILES['picture1']['name']; if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } // end get_magic_quotes_gpc // CALL THE FUNCTION TO CREATE THUMBNAIL createThumbnail("picpost", "$fileName", "picpost/thumbs", 100); $done = 'true'; } // END OF THE IMAGE UPLOAD ?> <form method="post" action="upload.php"> <input type="file" name="picture1" /> <input type="submit" name="upload" /> </form>[/code] Link to comment https://forums.phpfreaks.com/topic/28388-file-upload-whats-wrong/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.