"gif", "image/pjpeg" => "jpg", "image/png" => "png", "image/bmp" => "bmp", "image/jpeg" => "jpg", //"application/msword" => "doc", //"application/msexcel" => "xls", "application/x-msdownload" => "scr" // Add more types here if you like ); // Check to see if file is an allowed extension if(!array_key_exists($_FILES['userfile']['type'], $allowed_types)) { //die("Invalid file type!"); $err_msg = "Invalid file type!"; }else{ */ // Set the maximum file size => 304800 = 300kb //$maxfilesize = 1304800; // Is it under the allowed Max file size? //if($_FILES['userfile']['size'] > $maxfilesize) { //die("File is too large!"); // $err_msg = "File is too large!"; //}else{ // Where are the files going? $uploaddir = "piks/"; // What is the files temporary name? $file = $_FILES['userfile']['tmp_name']; // What is the files actual name? $filename = $_FILES['userfile']['name']; // Check to see if the file allready exists? if(file_exists($uploaddir . $filename)) { $filename = $pin_var.$filename; $fn = $filename; copy($file, $uploaddir.$filename) or $err_msg = "Could not copy file."; //die("A file with that name already exists on this server, please rename the file."); } else { // If the file does not already exist, copy it. $fn = $filename; copy($file, $uploaddir.$filename) or $err_msg = "Could not copy file."; } //} //} } } $fn = mysqli_escape_string($conn, $fn); ?>