I am confronted to an odd problem:
I want to upload a picture from my phone to a PHP Server using an HTML Form.
So I have an HTML form with a file picker that allow the user to use the camera if he/she visits the form with a mobile device or else he/she can just pick a file from the system.
<input type="file" name="attachment" required accept="image/*" capture>
LOCAL: Everything works fine, I can upload from my camera on mobile / gallery / my pc
On HEROKU Does not work if the file is a picture JUST taken from the camera.
On HEROKU: it works fine if the picture is from my Gallery ( even if it is the previously taken photo ) or a picture from the pc.
In the error case, the PHP script is not even run I got the following error from Heroku just after submitting the form:
Here are the logs from Heroku:
I tried increasing: post_max_size, upload_max_filesize, max_execution_time on .user.ini file. Changes were taken in consideration (checked with phpinfo()) but does not change the error.
I do not think that the PHP scripts is at fault as the script is not even considered when the error occurs, here it is anyway:
$target_dir = "uploads/";
$FileType = strtolower(pathinfo($_FILES["attachment"]["name"],PATHINFO_EXTENSION));
$target_file = $target_dir . generateRandomString() .'.'.$FileType;
if (move_uploaded_file($_FILES["attachment"]["tmp_name"], $target_file)) {
//Do next stuff with the file
If anyone has the slightest idea of what could be wrong, I would gladly accept some help
Thanks for reading :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…