I have a pretty standard file upload form (that is also writing to a mysql db). It was working fine throughout my testing, then I went and tested a file that was named with all capital letters. The file would not upload. Simple solution I figured, just rename the file before the upload with 'strtolower' but no luck. Also tried strtoupper, still no luck. I think I'm also running into this issue with files starting with numbers. (i did double check and yes the folder is writable.)
$upload_dir = "/path/to/the/upload/folder/entries/";
$new_filename = mysql_insert_id()."_".$filename;
$tmp_name = $_FILES["filename"]["tmp_name"];
move_uploaded_file($tmp_name, $upload_dir . $new_filename);
any help is GREATLY appreciated.
Need to isolate the step where the error is happening--what do you mean specifically, "the file will not upload"? Does no file get to the server? Does the rename not work? Is the mysql statement doing the insert not formed correctly? If the file never gets to the server, then you have nothing on which to invoke strtolower.
Take a known, working, uploadable file, upload it to be sure it works, then rename it to its uppercase version and try again. If picture.jpg works, does PICTURE.JPG? Or PICTURE.jpg? I'm wondering if there's something in the previous parts of your code that is deciding ".JPG" (or whatever capitalized extension) isn't a valid upload like ".jpg" is.