gpt4 book ai didi

php - 手机上传文件发送application/octet-stream

转载 作者:行者123 更新时间:2023-11-30 01:11:38 28 4
gpt4 key购买 nike

我有一个简单的视频文件上传表单。它可以在普通 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
}

这里是从普通电脑浏览器上传的文件转储

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"}

最佳答案

也许这会有所帮助。

根据 HTML form enctype :

multipart/form-data: No characters are encoded. This value is required when you are using forms that have a file upload control

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

关于php - 手机上传文件发送application/octet-stream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38382577/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com