Jump to content

[FAQ] My file upload doesn't work, what's wrong?


Recommended Posts

Troubleshooting file uploads

1st, read the [FAQ] entry for uploading a file to make sure you have each component necessary present in your script.

Uploading files to a directory:

http://criminalexistence.com/ceforums/i ... ic=18418.0

Uploading files to a database:

http://criminalexistence.com/ceforums/i ... ic=18420.0

If you are absolutely sure that all the necessary HTML form components are present, Follow each of the steps present in this article in detail:

Go to your php.ini configuration file and locate the following snippet...


; 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:\PHP\uploadtemp  ; temporary directory for HTTP uploaded files (will use system default if not specified)

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


Verify that C:\PHP\uploadtemp exists and has the proper write permissions. If the directory does not exist, create it and give it the proper write permissions, or change the value of upload_tmp_dir to another directory and apply the proper write permissions there.

Verify that file uploads are turned on via the file_uploads directive.

Verify that you are not trying to upload a file larger than 2MB in size, or larger than the value specified in upload_max_filesize.

If you can verify each of the above then you will be able to output the $_FILES superglobal after an upload attempt, as in:


   echo "<pre>";
   echo "</pre>";


If the variable is empty, then there is a problem with one of the above. If the variable contains the various data associated with the file then the problem is elsewhere.

Be sure to restart your HTTP server, if necessary, after applying any php.ini changes.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...