Laravel, Dropzone, and S3



我的dropzone配置了laravel和s3,对于小文件,一切都可以顺利进行。我可以看到上传的文件。

我正在尝试使用相同的方法上传2.5MB文件,但是我总是得到

`Network Error (tcp_error)
A communication error occurred: "Can't send more" The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
For assistance, contact your network support team.`

我更改了PHP设置以增加upload sizemax_post_size,但是什么都没有起作用

问题是什么?

下面的控制器中的代码

  $video = $request->file('file');
    if($video !==null) {
        $s3 = Storage::disk('s3');
        $stamp = Carbon::now();
        $email = $request->header('email');
        $videoFileName = $email . $stamp->toDateTimeString() . '.' . $video->getClientOriginalExtension();
        $filePath = 'videos/' . $videoFileName;
        $s3->put($filePath, fopen($video, 'r+'), 'public');
        Mail::queue('emails.videoUploaded', ['email' => $email], function ($message) use($email) {
            $message->from('mohammad@findearlyadopters.com', 'Mohammad Abu Musa');
            $message->to($email);
            $message->subject('Video Uploaded - FindEarlyAdopters.com');
        });
        Mail::queue('emails.uploadedVideoNotification', ['email' => $email , 'videoLocation'=>$s3->url($filePath)], function ($message) use ($email) {
            $message->from('videos@findearlyadopters.com', 'Mohammad Abu Musa');
            $message->to("mohammad@findearlyadopters.com");
            $message->subject('New Video Uploaded - FindEarlyAdopters.com');
        });
        return Response::json(array(
            'success' => true,
        ));
    }

dropzone.js代码下方

$("#videoUploader").dropzone({
        url: "{{route('postTestVideo')}}",
        headers: {
            'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'),
            'email':getParameterByName('email')
        },
        init: function() {
            this.on("success", function(file, response) {
                if(response.success == true)
                    window.location="{{route('yourTests',array('thank-you'=>true))}}";
                else
                    $('#error').show();
            })
        }
    });

我正在使用dokku来部署代码

web: vendor/bin/heroku-php-apache2 -C httpd.inc.conf -i php.ini public/

httpd.inc.conf

`Timeout 30
KeepAlive On
MaxKeepAliveRequests 50
KeepAliveTimeout 10
<IfModule prefork.c>
    StartServers          3
    MinSpareServers       2
    MaxSpareServers       5
    MaxClients            10
    MaxRequestsPerChild   1000
</IfModule>

这就是我在php.ini中拥有的

memory_limit = 512M
post_max_size = 150M
upload_max_filesize = 100M
max_execution_time = 86400
max_file_uploads = 40
/etc/httpd/conf/httpd.conf
Timeout 30
KeepAlive On
MaxKeepAliveRequests 50
KeepAliveTimeout 10
<IfModule prefork.c>
    StartServers          3
    MinSpareServers       2
    MaxSpareServers       5
    MaxClients            10
    MaxRequestsPerChild   1000
</IfModule>
# if you are using workers, update the IfModule worker.c section similarly.
/etc/php.ini
memory_limit = 100M

最新更新