我有一个简单的视频文件上传表格。它适用于普通PC,但从移动设备(Android)上传时,会将文件mime类型发送为application/octet-stream
,文件为null
,错误为1。
我不知道该怎么做。有人可以帮忙吗?
这是表格
<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:\wamp\tmp"
filename: "phpC612.tmp"
basename: "phpC612.tmp"
pathname: "C:\wamp\tmp\phpC612.tmp"
extension: "tmp"
realPath: "C:\wamp\tmp\phpC612.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:\wamp\tmp\phpC612.tmp"}
答案 0 :(得分:1)
也许这可能有所帮助。
multipart / form-data:没有字符被编码。当您使用具有文件上载控件的表单
时,此值必需
确保您的form
元素的属性enctype
设置为multipart/form-data
。