如何上传大尺寸图片

时间:2018-10-04 15:18:07

标签: php laravel

我要改变

memory_limit => -1 => -1

post_max_size => 25M => 25M

当我尝试dd($ request-> img);

如果我使用2mb可以工作,但是如果我使用6mb则可以在尝试dd时返回此值

UploadedFile {#434 ▼
  -test: false
  -originalName: "test.JPG"
  -mimeType: "application/octet-stream"
  -error: 1
  #hashName: null
  path: ""
  filename: ""
  basename: ""
  pathname: ""
  extension: ""
  realPath: "/Applications/MAMP/htdocs/test/public"
  aTime: 1970-01-01 07:00:00
  mTime: 1970-01-01 07:00:00
  cTime: 1970-01-01 07:00:00
  inode: false
  size: false
  perms: 00
  owner: false
  group: false
  type: false
  writable: false
  readable: false
  executable: false
  file: false
  dir: false
  link: false
}

更新

这是我的。 html

<form action="{{ route($route.'store') }}" method="POST" enctype="multipart/form-data">
   <input type="file" name="img" class="dropify" data-height="300" >
</form>

1 个答案:

答案 0 :(得分:0)

编辑您的php.ini文件并设置:

memory_limit = 32M
upload_max_filesize = 70M
post_max_size = 100M

然后重新启动apache。