Reputation: 23
I have a really weird problem
If I upload image less than 2 Mb(I don't know exact size) , there is not problem and if i print as dd;
UploadedFile {#530
-test: false
-originalName: "20170607_132957.jpg"
-mimeType: "image/jpeg"
-size: 883421
-error: 0
#hashName: null
path: "/tmp"
filename: "phpx8aY57"
basename: "phpx8aY57"
pathname: "/tmp/phpx8aY57"
extension: ""
realPath: "/tmp/phpx8aY57"
aTime: 2017-10-09 06:12:07
mTime: 2017-10-09 06:12:07
cTime: 2017-10-09 06:12:07
inode: 35785
size: 883421
perms: 0100600
owner: 33
group: 33
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}
But if I try upload image more than 2 mb and print as dd function();
UploadedFile {#530
-test: false
-originalName: "IMG_20171004_193910~3.jpg"
-mimeType: "application/octet-stream"
-size: 0
-error: 1
#hashName: null
path: ""
filename: ""
basename: ""
pathname: ""
extension: ""
realPath: "/var/www/api/test/public"
aTime: 1970-01-01 00:00:00
mTime: 1970-01-01 00:00:00
cTime: 1970-01-01 00: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
}
There's not filename. And mimeType is looking application/octet-stream.
I tried raise system's upload size by php.ini but it's not working. And I need advice. Thank you.
I upload files to system as form-data
System: PHP 7.1 , Laravel 5.4
Upvotes: 2
Views: 1523
Reputation: 23
I solved my problems. I tried to write wrong file path.
I printed php.ini --v on ubuntu server and server back file path as /etc/php/7.1/cli/php.ini but I printed phpinfo() function in index.php and I saw /etc/php/7.1/fpm/php.ini.
I don't know why they are different. I suppose they are same but they weren't.
Upvotes: 0
Reputation: 346
Are you sure you changed both parameters in config file?:
post_max_size = 128M
upload_max_filesize = 128M
Upvotes: 1
Reputation: 137
Use image intervention for image upload in laravel, Refer Docs, http://image.intervention.io/getting_started/installation
Upvotes: 0