問題是我創(chuàng)建了以下表單:<form action="" method="get"> <div class="select"> <input name="u" type="radio" value="meme" class="memeSelect" <?php echo $selectMeme ?>> <label for="meme">Meme</label> <input name="u" type="radio" value="plantilla" class="plantillaSelect" <?php echo $selectPlantilla ?>> <label for="plantilla">Plantilla</label> <input type="submit" class="invisible selectMemePlantilla"> </div></form><form enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post"> <div class="meme <?php echo $invisibleMeme ?>"> <input type="hidden" name="MAX_FILE_SIZE" value="20000"/> <input type="file" class="file" name="file" accept="image/png, image/jpeg, image/gif, image/pjpeg"> <h2>Elije las clases para el meme</h2> <div class="clases"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> </div> <span><?php echo $error ?></span> <input type="submit" name="uploadBtn" value="Upload"> </div> <div class="plantilla <?php echo $invisiblePlantilla ?>"> <input type="hidden" name="MAX_FILE_SIZE" value="20000"/> <input type="file" class="file" name="file" accept="image/png, image/jpeg, image/gif, image/pjpeg"> <h2>Elije las clases para la plantilla</h2> <div class="clases"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> </div> <span><?php echo $error ?></span> <input type="submit" name="uploadBtn" value="Upload"> </div></form>如您所見,上傳圖片的頁面,首先有一個獲取表單轉(zhuǎn)到上傳模因或模板的頁面,然后發(fā)布將圖片上傳到服務(wù)器的帖子。第一種形式完美運(yùn)行,但第二種形式不行,我總是跳過沒有文件上傳的錯誤 4。我創(chuàng)建了另一個文件來查看服務(wù)器是否存在問題或其他問題,但一切正常。問題一定是在嘗試使用 get 時,但我不知道如何修復(fù)它。
1 回答

MYYA
TA貢獻(xiàn)1868條經(jīng)驗(yàn) 獲得超4個贊
此錯誤可能有兩個原因:
您對兩種形式
plantilla
和meme
. 您應(yīng)該使用不同名稱的文件字段,因?yàn)閮烧叨季哂邢嗤拿Qfile
。move_uploaded_file
需要目的地的絕對路徑。您應(yīng)該使用完整路徑以使其正常工作。
謝謝,希望對你有幫助?。?/p>
- 1 回答
- 0 關(guān)注
- 130 瀏覽
添加回答
舉報
0/150
提交
取消