我有一个要求上传图片的表单,它构建在Laravel5.2上。我的桌面上的表单工作得很好,当我尝试用手机上传图片时,他们没有被识别,因为没有上传图片,没有上传任何建议,这里是我的代码。
$destinationPath = 'uploads';
// upload path
$extension = Input::file('picture')->getClientOriginalExtension();
// getting image extension
$fileName = rand(11111,99999).'.'.$extension;
// renameing image
Input::file('picture')->move($destinationPath, $fileName);
// uploading file to given path发布于 2016-12-20 11:00:17
public function uploadPicture(Request $request){
$picture = $request->file('picture');
if($picture->isValid()){
$destinationPath = public_path() . '/uploads/';
$picture_name = time() . '-' . str_random(15) . '.' .
$picture->getClientOriginalExtension();
$picture->move($destinationPath, $picture_name);
}
}发布于 2019-09-15 07:08:55
对于需要帮助的其他人,只需转到php.ini in xampp并将以下内容更改为:
upload file size max:
upload_max_filesize = 50M
post_max_size = 50M
max_input_time = 300
max_execution_time = 300这对我有用。
发布于 2019-10-12 21:04:17
问题是upload_max_filesize,因为很多设备在高分辨率上捕捉照片,图片很重。
https://stackoverflow.com/questions/41239812
复制相似问题