izlik Posted May 16, 2007 Share Posted May 16, 2007 Hey there, after searching trou google i did not find what i need, so i wonder if anyone know where i can find an upload script "mostly for image upload use" that has multiple categorys to choose from when uploading. Link to comment https://forums.phpfreaks.com/topic/51589-requesting-upload-script/ Share on other sites More sharing options...
irvieto Posted May 16, 2007 Share Posted May 16, 2007 Hey.. What do you mean with multiple categories to choose? here I post a small piece of code to "validate" an upload file <?php $extensions = array(".jpg",".png",".jpeg",".gif"); if( is_uploaded_file($_FILES['image1']['tmp_name']) ){ $image1ext = substr(strrchr ($_FILES['image1']['name'], "."), 0); // get the extension $image1name = "name_of_the_file"; //without the extension if( in_array($image1ext,$extensions) ){ if( !move_uploaded_file($_FILES['image1']['tmp_name'],"./upload_directory/".$image1name.$image1ext) ){ die("Cant move file"); } else { echo "Success!"; } } else { echo "Invalid File Type. The uploaded file is not a valid image file."; } } ?> Link to comment https://forums.phpfreaks.com/topic/51589-requesting-upload-script/#findComment-254158 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.