PHP Uploading Files

心不动则不痛 提交于 2020-01-10 04:03:27

问题


I'm having a problem uploading files in PHP. When I submit, $_FILES[] is empty. I feel like this is such a n00b question :/

My form:

<form method="post" action="uploadfile.php">
<input type="hidden" name="MAX_FILE_SIZE" value="300000" />
Image: <input name="ImageFile" type="file" /><br />
<input type="submit" value="Add Image" /><br />
</form>

Relevant php.ini:

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = "c:\php5\upload\"

; Maximum allowed size for uploaded files.
upload_max_filesize = 300M

c:\php5\upload\ is writable by IUSR_HOSTNAME

Any thoughts on what else I should check?


回答1:


Make sure your form tag has this attribute: enctype="multipart/form-data"

Without it the files will not get uploaded.



来源:https://stackoverflow.com/questions/823211/php-uploading-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!