我已经使用laravel和dropzone将块上传文件的代码写入AWS服务器,但我遇到了有线问题。 30秒后我的角度被取消了。我已经将PHP参数设置为max。在这里。
post_max_size = 200M
max_execution_time = 360
max_input_time = 120
memory_limit = 128M
这是我的PHP(Laravel代码)
$aws=Storage::disk('s3');
$receiver = new FileReceiver("media", $request, HandlerFactory::classFromRequest($request));
if ($receiver->isUploaded() ) {
// receive the file
$save = $receiver->receive();
// check if the upload has finished (in chunk mode it will send smaller files)
if ($save->isFinished() === true) {
// save the file and return any response you need
/*print_r($save->getFile());
exit;*/
return $aws->put($files->getClientOriginalName(),file_get_contents($save->getFile()),'public');
} else {
// we are in chunk mode, lets send the current progress
/** @var AbstractHandler $handler */
$handler = $save->handler();
return response()->json([
"done" => $handler->getPercentageDone(),
]);
}
} else {
throw new UploadMissingFileException();
}
这是我的dropzone设置。
this.dropzoneConfig ={
url : environment.apiurl+'/project/driveupload/?section=1&projectid='+this.projectId,
acceptedFiles:"audio/*",
autoReset:1,
chunking: true,
paramName: 'media',
maxFilesize: 400000000,
chunkSize:4000000
};
有人可以帮忙解决这个问题吗?是否有一些角度设置,我必须设置?
PS:我正在使用laravel 5.5和angular 4
答案 0 :(得分:0)
我通过更改dropzone中的设置来解决我的错误。
this.dropzoneConfig ={
url : environment.apiurl+'/project/driveupload/?section=1&projectid='+this.projectId,
acceptedFiles:"audio/*",
autoReset:1,
chunking: true,
paramName: 'media',
maxFilesize: 400000000,
chunkSize:4000000,
timeout:400000000 // increased time in millisecond.
}