Php 为什么不能上传pdf文件?
这是html代码:Php 为什么不能上传pdf文件?,php,upload,Php,Upload,这是html代码: <form id="upload" action="upload.php" method="POST" enctype="multipart/form-data"> <fieldset> <legend>html upload</legend> <input type="hidden" id="MAX_FILE_SIZE" nam
<form id="upload" action="upload.php" method="POST" enctype="multipart/form-data">
<fieldset>
<legend>html upload</legend>
<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="300000" />
<div>
<label for="fileselect">select file</label>
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
</div>
<div >
<button type="submit">upload</button>
</div>
</fieldset>
</form>
上载pdf:
array(1) { ["fileselect"]=> array(5) { ["name"]=> array(1) { [0]=> string(15) "Untitled-12.pdf" } ["type"]=> array(1) { [0]=> string(0) "" } ["tmp_name"]=> array(1) { [0]=> string(0) "" } ["error"]=> array(1) { [0]=> int(2) } ["size"]=> array(1) { [0]=> int(0) } } } can not move
但是我不能上传pdf文件
为什么不能上传pdf文件?首先,有一个问题,请检查以下行:
<input type="file" id="fileselect" name="fileselect" multiple="multiple" />
具有多个选择项的输入文件必须以数组的形式命名,以便它可以保存多个文件名,如:
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
如果没有此选项,您将无法迭代所有文件。您收到的错误消息是什么?有错误吗?pdf文件是否大于最大文件大小值?错误:echo khong the move;pdf文件的大小只有300kb,我建议您在上传时始终检查$myFile[name][$i]['error']。它通常会告诉你问题是什么,或者至少会引导你找到解决方案谢谢,我错过了发布问题的时候。但这不是我的问题上传pdf:array1{[fileselect]=>array5{[name]=>array1{[0]=>string15 Untitled-12.pdf}[type]=>array1{[0]=>string0}[tmp_name]=>array1{[0]=>string0}[error]=>array1{[0]=>int2}[size]=>array1{[0]=>int0}无法移动
<input type="file" id="fileselect" name="fileselect" multiple="multiple" />
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />