从手机上传文件发送应用程序/八位字节流



我有一个简单的视频文件上传表格。它可以在普通PC上运行,但是从移动设备(Android)上传时,它会将文件mime类型作为文件null和错误1 application/octet-stream发送。

我不知道该怎么办。谁能帮忙?

这是表格

<input type="file" id="video_link" name="video[link]" class="form-control" accept="video/*">

以下是在移动设备上提交的视频var_dump

UploadedFile {#9 ▼
  -test: false
  -originalName: "VID-20160712-WA0029.mp4"
  -mimeType: "application/octet-stream"
  -size: 0
  -error: 1
  path: ""
  filename: ""
  basename: ""
  pathname: ""
  extension: ""
  realPath1970: "/app/web"
  aTime: 1970-01-01 00:00:00
  mTime: 1970-01-01 00:00:00
  cTime: -01-01 00: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
}

这是从常规PC浏览器上传的文件转储

VideoController.php on line 59:
UploadedFile {#14 ▼
  -test: false
  -originalName: "videoplayback.mp4"
  -mimeType: "video/mp4"
  -size: 684535
  -error: 0
  path: "C:wamptmp"
  filename: "phpC612.tmp"
  basename: "phpC612.tmp"
  pathname: "C:wamptmpphpC612.tmp"
  extension: "tmp"
  realPath: "C:wamptmpphpC612.tmp"
  aTime: 2016-07-14 05:43:25
  mTime: 2016-07-14 05:43:25
  cTime: 2016-07-14 05:43:25
  inode: 0
  size: 684535
  perms: 0100666
  owner: 0
  group: 0
  type: "file"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: false
        linkTarget:"C:wamptmpphpC612.tmp"}

也许这会有所帮助。

根据 HTML 表单格式:

多部分/表单数据:不对字符进行编码。当您使用具有文件上载控件的表单时,此值是必需的

确保您的form元素将属性enctype设置为 multipart/form-data

相关内容

  • 没有找到相关文章

最新更新