Asked by: SheperdOfFire
I have a valid .eps
file which I want to upload.
My validator looks like this:
// $file is an instance of UploadedFile
$validator = \Validator::make( [
'file' => $file
], [
'file' => 'required|mimes:jpg,jpeg,png,tiff,psd,ai,eps,pdf'
] );
\dd($validator->fails());
if ($validator->fails() ){
...
}
$validator->fail()
evaluates to true at the moment, causing my script to not upload the file.
Because all other file extensions are working, I think this is because laravel doesn't understand the eps file type. Therefore I'd like to implement the eps mime types myself but I don't know how to do this.
The file I try to upload is named 2365 MD8300_PC_03.eps
and has application/octet-stream
as mimetype.
Any ideas?
Update:
When I dd
$file
, it's output is this:
UploadedFile {#410 ▼
-test: false
-originalName: "2365 MD8300_PC_03.eps"
-mimeType: "application/postscript"
-size: 310578
-error: 0
#hashName: null
path: "/private/var/tmp"
filename: "phpy3tsMr"
basename: "phpy3tsMr"
pathname: "/private/var/tmp/phpy3tsMr"
extension: ""
realPath: "/private/var/tmp/phpy3tsMr"
aTime: 2017-07-11 12:08:52
mTime: 2017-07-11 12:08:50
cTime: 2017-07-11 12:08:50
inode: 21487530
size: 310578
perms: 0100600
owner: 504
group: 0
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}
So the actual mime type is correct, it's just that $file->getMimeType()
returns an incorrect value of application/octet-stream
.
No comments:
Post a Comment