When uploaded files are of the type image, they get uploaded properly. Non-image (atleast PDF in my case) doesn't work.
Doing a dump on $request to investigate gave some more details, which may be helpful. When it errors, it has the following request dump:
0 => UploadedFile {#111
-test: false
-originalName: "filename.pdf"
-mimeType: "application/octet-stream"
-size: 0
-error: 1
#hashName: null
path: ""
filename: ""
basename: ""
pathname: ""
extension: ""
realPath: "CODEHOME/public"
aTime: 1970-01-01 01:00:00
mTime: 1970-01-01 01:00:00
cTime: 1970-01-01 01:00:00
inode: false
size: false
perms: 00
owner: false
group: false
type: false
writable: false
readable: false
executable: false
file: false
dir: false
link: false
}
but when it works, i.e. with the image file, the dump is more sensible
0 => UploadedFile {#111
-test: false
-originalName: "12040002.jpg"
-mimeType: "image/jpeg"
-size: 807682
-error: 0
#hashName: null
path: "/tmp"
filename: "phpBTeakk"
basename: "phpBTeakk"
pathname: "/tmp/phpBTeakk"
extension: ""
realPath: "/tmp/phpBTeakk"
aTime: 2017-04-04 22:56:50
mTime: 2017-04-04 22:56:50
cTime: 2017-04-04 22:56:50
inode: 37365
size: 807682
perms: 0100600
owner: 33
group: 33
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}
Note that while I have mentioned the validation details above, the dump is taken prior to the validator method in the controller, so it probably shouldn't have any impact on the issue.
As is visible, it's probably trying to upload the file to the project root, instead of '/tmp' when doing the non-image upload and that's why it's likely failing.
(I have just renamed the folder name in the dump to CODEHOME)
validation.uploaded means the file failed to upload, there are many reasons for that that you need to explore yourself.
You're correct, and that was my first thought as well.
As I have explained in the issue above, I have used the same upload form while changing only the type of file I uploaded. Also, the files being uploaded were from the same local folder.
The realPath changing makes me inclined to think that this could be a bug.
I will continue to check this further and report back if anything changes.
what is the size of the pdf you are uploading? Are you sure it is not greater than your file max size?
Okay, there is an update.
Good: Other files were uploading
Bad: One particular PDF is not uploading. Renaming it doesn't help either. It's not a secure file but of PDF-1.5 format. The ones I can upload are PDF-1.4
@laurencei wow, this is embarrassing. The one thing I should've checked, I never event thought to do. That's indeed the case.
Closing the bug
what is the size of the pdf you are uploading? Are you sure it is not greater than your file max size?
Thanks , it works for me .
same problem with me with any file what is the reason??