This code will change file extension from uppercase to lowercase.
If there is a file called dog.JPG on my desktop, when I try to upload it fails. This script will convert it to a lowercase and upload it successfully.
Remember this is only part of the script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$arr_file_types = ['image/png', 'image/gif', 'image/jpg', 'image/jpeg']; $_FILES['file']['name'] = strtolower($_FILES['file']['name']); if (!(in_array($_FILES['file']['type'], $arr_file_types))) { echo "false"; return; } move_uploaded_file($_FILES['file']['tmp_name'], 'reports/'. $clientname .'/' . $_FILES['file']['name']); echo "success"; |