我有使用Laravel和S3配置的dropzone,对于小文件,一切都运行顺畅。我可以看到上传的文件。
我正在尝试使用相同的方法上传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 size
和max_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
答案 0 :(得分:0)
/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