Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:php5upload"

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

c:php5upload is writable by IUSR_HOSTNAME

Any thoughts on what else I should check?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
571 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

Without it the files will not get uploaded.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...