AWSのEC2にLaravel5.6を入れて、EC2内のEBSにファイル(PDF)をアップロードするプログラムを作成しました。
500MB程度のファイルは成功するのですが、700MB程度のファイルになると、アップロードが出来ていません。
Laravelのコントローラー内で、
$error = $request->file('testupload')->getErrorMessage();
でエラーメッセージを見ると、
The file "〇〇.pdf" was only partially uploaded.
となっています。
思いつく設定としては、.htaccessで以下を設定しています。
htaccess
1max_execution_time 300 2max_input_time 300 3post_max_size 1000M 4memory_limit 1500M 5upload_max_filesize 1000M
また、EC2にロードバランサーを使っていますので、ロードバランサーの可能性も考え、
ロードバランサーのアイドル時間は、
EC2
1アイドルタイムアウト 300 秒
に設定しています。
また、httpd.confでは、
httpd.conf
1KeepAliveTimeout 120 2Timeout 120
に設定しています。
プログラムは単純で、
html
1<form method="post" action="/upload" enctype="multipart/form-data"> 2 {{ csrf_field() }} 3 <input type="file" name="testupload"> 4 <input type="submit" name="test_upload" value="アップロード"> 5</form>
Controller
1public function upload(Request $request) 2{ 3 if ($request->file('testupload')->isValid([])) { 4 logger('upload success'); 5 } else { 6 $error = $request->file('testupload')->getErrorMessage(); 7 logger($error); 8 } 9 return view('finish'); 10}
だけのシンプルなものです。
サーバーのメモリも足りていると思います。
$ free -m total used free shared buffers cached Mem: 959 334 624 0 44 99 -/+ buffers/cache: 190 768 Swap: 1023 0 1023
もう自分では思いつく原因がないのですが、何か見落としてそうな設定があれば、ご教授いただければ幸いです。
どうぞよろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー