AGAMES 討論區

標題: PHP upload files 問題 [打印本頁]

作者: dlalden    時間: 2008-10-29 21:25:58     標題: PHP upload files 問題

Q:
我用<input type="file" name="uploadFile" /> 去upload file的

我用
echo $_FILES['uploadFile']['name'];
就一直都read唔到同話我錯..

Notice: Undefined index: uploadFile in ......

但係我用 if( isset($_POST['uploadFile'] ) echo "TRUE";
佢又直係出個 TRUE 俾我

請問我究竟錯左係邊度呀

A:
you have omitted to set the form enctype as multipart as below.

<form enctype="multipart/form-data" action="__URL__" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
</form>




歡迎光臨 AGAMES 討論區 (http://061244113049.ctinets.com/) Powered by Discuz! X2