我正在上传图像/文件上传多个图像,但它只显示图像名称而不是使用 java 脚本的 MIME 类型
<input type='file' name='data[Expensedetail][description]["+i+"][expense_file][]' id='expense_file"+i+"' style='display: none' multiple='true'>
其中"i"是循环 i = 0,1,2,3 ...一切正常,我在帖子中得到了这个结果[图片详情][1]
[1]:https://i.stack.imgur.com/ixaXr.png 和使用
$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo finfo_file($finfo, $file); //$file is the file name coming in above image in array
echo $file;
无法打开流:没有此类文件或目录
在我看来,您的
form
元素中缺少enctype="multipart/form-data"
- 没有它,服务器会将文件输入作为文本字段处理并仅接收文件名。