onlyican Posted August 6, 2010 Share Posted August 6, 2010 Hi All Not so much help as here is a handy class for uploading images Please feel free to find security bugs and let me know. Also feel free to use it if you want. http://onlyican.com/test_samples/bl_upload_img.phps To use the class, simply use the following require_once('bl_upload_img.php'); $objUploadImg = new UploadImg(); //Set values here if you wish such as $objUploadImg->setFormField('myFormField'); // The Name from <input type="file" name="myFormField" /> $objUploadImg->setSaveDirMain($_SERVER['DOCUMENT_ROOT'].'/MyImageFolder'; //Make sure to set the permissions //You can change most settings, just look at the function setDetaultValues() to get the function name //Now upload the image if($objUploadImg->uploadImage()){ $strFileName = $objUploadImg->getFileNameMain(); }else{ echo 'Error uploading Image<br />'.$objUploadImg->getErrorMessage(); } Link to comment https://forums.phpfreaks.com/topic/209967-image-upload-script/ Share on other sites More sharing options...
pagegen Posted August 6, 2010 Share Posted August 6, 2010 havnt tested the script yet but how about adding a upload progress bar? Link to comment https://forums.phpfreaks.com/topic/209967-image-upload-script/#findComment-1095934 Share on other sites More sharing options...
onlyican Posted August 6, 2010 Author Share Posted August 6, 2010 Could do, Was also going to add better error handling So system Errors dont echo out the same as User errors. (IE, currently, Folder not valid and file not an image is handled together) Then put errors in an array, so the user can either get the error ID and make there own message or can update the Error Handling Array. Link to comment https://forums.phpfreaks.com/topic/209967-image-upload-script/#findComment-1095954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.