5242880) { die("File size is too big!"); } //allowed file type Server side check switch(strtolower($_FILES['FileInput']['type'])) { //allowed file types case 'image/png': case 'image/gif': case 'image/jpeg': case 'image/pjpeg': case 'text/plain': case 'text/html': //html file case 'application/x-zip-compressed': case 'application/pdf': case 'application/msword': case 'application/vnd.ms-excel': case 'video/mp4': break; default: die('Unsupported File!'); //output error } $File_Name = strtolower($_FILES['FileInput']['name']); $File_Ext = substr($File_Name, strrpos($File_Name, '.')); //get file extention $Random_Number = rand(0, 9999999999); //Random number to be added to name. $NewFileName = $Random_Number.$File_Ext; //new file name if(move_uploaded_file($_FILES['FileInput']['tmp_name'], $UploadDirectory.$NewFileName )) { die('Success! File Uploaded.'); }else{ die('error uploading File!'); } else { die('Something wrong with upload! Is "upload_max_filesize" set correctly?'); } //http://www.formget.com/ajax-image-upload-php //http://www.formget.com/upload-multiple-images-using-php-and-jquery/ //http://www.infotuts.com/ajax-multiple-image-upload-javascript-and-php/ //http://blog.teamtreehouse.com/uploading-files-ajax //http://hayageek.com/docs/jquery-upload-file.php //http://code.tutsplus.com/tutorials/uploading-files-with-ajax--net-21077 //https://github.com/LPology/Simple-Ajax-Uploader //http://www.code-hound.com/upload-multiple-files-at-once-with-jquery-and-php/ ?>