1
我有以下表單。正在提交PHP輸入類型文件字段,文件不是
<form action="picture.php" method="POST" class="pic_form">
<span class="picture_box">
<input type="file" accept="image/*" name="pic_upload" class="picture_upload_input" />
<p class="upload_info">Only file types of the extensions gif, jpg, png and svg are allowed. The maximum file size is 15mb. If your file is larger than 15mb, it will not upload.</p>
</span>
<input type="hidden" name="uid" value="<?php echo $_SESSION['userid']; ?>" />
<input type="button" name="upload_button" value="Upload" class="upload_button" />
</form>
我驗證該文件是否已設置,並且它是使用jQuery的正確類型和大小。當我提交此表單時(使用jQuery),該字段已發佈
$_POST['pic_upload']
這會返回true。
但是,文件本身並沒有公佈
$_FILES['custom_pic_upload']
這將返回false和
var_dump($_FILES['custom_pic_upload']);
返回null。
如何讓文件本身上傳?
好的,我沒有這個問題了,但現在,顯然如果(isset($ _ POST ['pic_upload']))返回false – user4559334
是否提交了其他POST值? '的print_r($ _ POST);'。 – chris85
nope。沒有提交任何變數 – user4559334