RE: [PHP] file uploading error - can't upload "none"

From: Date: Thu, 11 Jan 2001 12:15:14 +0000
Subject: RE: [PHP] file uploading error - can't upload "none"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33966@lists.php.net to get a copy of this message
Fixed... <? if ($FileType== "none") { print "ERROR! - You must specify a File Type before we can begin the upload.<BR>"; } else { if ($filezip== "none") { print "ERROR! - You must specify a zip file to upload.<BR>"; } else { copy($filezip, "/home/sites/site1/ftp/$FileType/$filezip_name"); unlink($filezip); } if($fileimage== "none") { $fileimage_name = 'nopic.jpg'; } else { copy($fileimage, "/home/sites/site1/ftp/$FileType/$fileimage_name"); unlink($fileimage); } if($filezip_size >= 1048576) { $filezip_size = round($filezip_size / 1048576 * 100) / 100 . " Meg"; } elseif($filezip_size >= 1024) { $filezip_size = round($filezip_size / 1024 * 100) / 100 . " Kb"; } else{ $filezip_size = $filezip_size . " Bytes"; } $FileDate = date("Y-m-d H:i:s"); } ?> -----Original Message----- From: David Smith [mailto:webmaster@indywebdesign.com] Sent: Thursday, January 11, 2001 5:45 AM To: 'Php-General@Lists. Php. Net' Subject: [PHP] file uploading error - can't upload "none" Below is my code. I am uploading an image and a zip file only I want to make it insert nopic.jpg if they don't upload an image. When I change if($fileimage== "none") { to if($fileimage== "none") { $FileImage = 'nopic.jpg'; } else { $FileImage = $fileimage_name; } I get error can't upload "none" Is there a fix for this? ---------------------------- <? if ($FileType== "none") { print "ERROR! - You must specify a File Type before we can begin the upload.<BR>"; } else { if ($filezip== "none") { print "ERROR! - You must specify a zip file to upload.<BR>"; } elseif($fileimage== "none") { print "ERROR! - You must specify an image file to upload.<BR>"; } else { copy($filezip, "/home/sites/site1/ftp/$FileType/$filezip_name"); copy($fileimage, "/home/sites/site1/ftp/$FileType/$fileimage_name"); unlink($filezip); unlink($fileimage); if($filezip_size >= 1048576) { $filezip_size = round($filezip_size / 1048576 * 100) / 100 . " Meg"; } elseif($filezip_size >= 1024) { $filezip_size = round($filezip_size / 1024 * 100) / 100 . " Kb"; } else{ $filezip_size = $filezip_size . " Bytes"; } $FileDate = date("Y-m-d H:i:s"); } } ?> Thanks... WreckRman2 Combat Flight Center http://www.combatfs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#33966) next »