问题修正谢谢
当上传超过2mb的文件时,mineType会更改,并且该文件不会发送到服务器
当上传文件< 2mb是好的,而当文件更多2mb时(e.q )。( 7mb)不是上传
服务器Apache
是文件> 2mb (不上传)
'test' => false,
'originalName' => 'IMG_1241.JPG',
'mimeType' => 'application/octet-stream',是文件< 2mb (正在上传成功)
'originalName' => '129730813_1484434941749595_546569280234563733_n.jpg',
'mimeType' => 'image/jpeg',当更多的2mb上传是更改mineType
memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M这是我的代码
UIkit.upload('.js-upload', {
url: this.required_api.dataset.uploadProcess,
multiple: true,
allow : '*.(jpg|jpeg|gif|png)',
name: 'files[]',
type: 'text',...
foreach ($request->file('files') as $file) {
$item = $file->getClientOriginalName();
$item_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', $item);
$item_ext = $file->extension();
$filename = Str::slug($item_name);
$count = MediaModel::where('file_without_ext', 'LIKE', "{$filename}%")->count();
if($count > 0) {
$filename = $filename . '-'. ++$count;
}
/** only admin */
$admin_dir = public_path('/wp-upload/admin');
$img_size_small = Image::make($file->path());
$img_size_small->resize(150, 150, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($admin_dir.'/'.$filename.'-150x150.'.$item_ext, 100);
}发布于 2022-08-22 15:41:40
如果您使用nginx
您必须增加client_max_body_size。它的默认值是每个文件1MB。
在nginx项目的default.conf中添加以下内容:
server {
...
client_max_body_size 32M;
...
} https://stackoverflow.com/questions/73446812
复制相似问题