Upload a file - Wordpress user


Hi -
I’m writing a wordpress plugin that maintains a database for a small local business. It’s nothing special, but as part of the plugin, the user (who will be logged in as an admin) needs to upload a file for me to parse.

This user is just barely compter savvy enough to enter things into a form on a web page. I can teach her how to use filezilla, but I’d rather not have to. Instead, I want her to browse to the file to upload, and click “Import” (or whatever). I have tried several renditions of PHP code (both within my plugin and in other plugins) that should do things like this, and they all result in no file being uploaded.

Is there something that DreamHost does to prevent a file upload by a user? If so, is there a way around it?


What’s the filetype you’re trying to upload? The media uploader built in to WordPress should be able to do anything, but you may have to teach it (and your .htaccess) the types.


Most common “gotcha”: For a HTML form to send uploads (from an “”) correctly, the form must be configured as follows:

(The action may be set to whatever script is appropriate, of course. But the method and encoding type absolutely have to be set as shown.)

Once that’s done, information on the uploaded file should appear in the PHP $_FILES superglobal as normal. See the PHP manual for details.