将文件上传到apache服务器时遇到问题,导航器一直显示连接已重置的消息。我尝试使用小文件(100kb),但效果很好,但是当我尝试500kb或更多文件时,连接已重置...
这是我用于上传的php.ini设置:
upload_max_filesize = 320M
memory_limit = 12800M
max_input_time = 6000
max_execution_time = 3000
post_max_size = 300M
default_socket_timeout = 600
表单代码:
<form enctype="multipart/form-data" method="POST" action="{{ url('FruitCreate') }}" >
{{ csrf_field() }}
<input type="text" name='name'>
<input type="text" name='price'>
<input type="hidden" name="MAX_FILE_SIZE" value="30000000" />
<input type="file" name='image'>
<select name='quantitytype'>
<option value='unity'> unity </option>
<option value='kg'> kg </option>
</select>
<button type='submit'> submit </button>
这是我的控制器,用于向db输入新行:
class fruitController extends Controller
public function createFruit(Request $request){
$file = $request->file('image');
$fruit = new fruit;
$imageContent = $file->openFile()->fread($file->getSize());
$fruit = new fruit;
$fruit->picture = $imageContent;
$fruit->name = $request->name;
$fruit->quantitytype = $request->quantitytype;
$fruit->price = $request->price;
$fruit->save();
return redirect('FruitsChangingPricePanel');
//
感谢您的帮助!!!!!