简体   繁体   中英

File sometimes got uploaded successfully & sometimes it disappears from the /tmp directory

I am running a Laravel 5.2 application with PHP 5.5 and nginx on Ubuntu 14.04.

Sometimes it got uploaded successfully without any error, also sometimes out of nowhere it produces this error.

Laravel抛出的异常图像

I don't know what the problem is or what is happening. I can't reproduce the error every time. It just happens randomly!


Here is what I've tried (already configured):

php.ini:

post_max_size: 20M
upload_max_filesize: 20M
memory_limit: -1
max_execution_time: 60
max_input_time: 60

nginx configuration:

client_max_body_size 100m;

i don't know how it happen..!!you can try below code and may be help you..!

$bannerimage = $req->file('uploadusers');
                    if($bannerimage!='') 
                    {   
                        $destination = 'public/uploadimage/';
                        $newname = str_random(5);
                        $ext = $bannerimage->getClientOriginalExtension();
                        $filename = $newname.'-original.'.$ext;
                        $newFilename = $newname.'.'.$ext;
                        if($bannerimage->move($destination, $filename))
                        {
                            copy($destination . $filename, $destination . $newFilename);
                        }
                    }

I posted my question on Laracasts Forums here & that is what i got:

It got removed in the 5.2.14 release, here is the commits of UploadedFile Class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM