Support » Plugins » Hacks » Where should plugins store uploaded (non-attachment/library) files?

  • Resolved timfs



    I’ve searched the net and the codex pages for the last two days but I couldn’t find an answer, also plugin authors seem to do it in 1000 different ways.

    I’m developing a plugin where i need to upload files, files that do not belong to posts (ie they aren’t attachments), shouldn’t appear in the media library, and might need to be unpacked into multiple files.

    And now I’m wondering whether there is a “best practice” regarding such uploads made by plugins? Is it ok to store files in the plugin folder, or should the wordpress uploads folder be used? And if the latter is the case, is it ok to use custom sub-folders in the wordpress uploads folder?

    Regards, Tim

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    I’m not aware of a best practice, otherwise there wouldn’t be 1000 different ways of doing it. I would use the uploads folder, as you could run into permissions issues anywhere else on some servers. Adding your own sub-folder would be the polite thing to do, and shouldn’t create any problems.

    I just found a stray sub-folder in my uploads folder left by a plugin I was testing many months ago, hadn’t caused any problems in that time. Somehow be clear that your sub-folder is associated with your plugin so that no one mistakes it for hacker data.



    FWIW, the eShop plugin installs its plugin-specific files to wp-content/eshop_files when the plugin is activated. Files that are uploaded by the user via the plugin are stored in wp-content/eshop_downloads.




    Thanks for your input. I guess I’ll give the separate folder in the uploads folder a shot then 🙂

    Regards, Tim

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Where should plugins store uploaded (non-attachment/library) files?’ is closed to new replies.