I am having a slight problem with a picture upload script. I seems to work just fine except when the picture name has an apostrphe in the name. How do all of you deal with this problem. Do you just rename the file to something else when you upload it. Here is the script that I am using. It is called from a form using multipart/form-data. Thanks for the help.
displayHeader("File Uploaded"); printf("<b>Uploaded File Details</b><br><br>"); printf("Name: %s <br>", $_FILES["photo"]["name"]); printf("Temporary Name: %s <br>", $_FILES["photo"]["tmp_name"]); printf("Size: %s <br>", $_FILES["photo"]["size"]); printf("Type: %s <br> <br>", $_FILES["photo"]["type"]); if (copy($_FILES["photo"]["tmp_name"],"{$GLOBALS['IMAGE_DIR']}/{$_FILES['photo' ]['name']}")) {printf("<b>File successfully copied</b>");} else {printf("<b>Error: failed to copy file</b>");} // Put picture path into database and assosiate with a product $query = "insert into picture (product_id, path) values ( {$_POST['product_id']}, '{$GLOBALS['IMAGE_DIR']}/{$_FILES['photo']['name']}' )"; mysql_query($query) or die (mysql_error()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php