Skip Navigation

[Resolved] Upload destination for files

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 6 replies, has 2 voices.

Last updated by fleurP 3 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#2141827

I have setup a document manager post type. One of my custom fields are a file upload. Is it possible to designate a folder to upload the fiels to as I dont want the files mixed in with my Media Library? Even better, if the files could be loaded into folders that represent the categories created for the post type.

#2141961

Hello and thank you for contacting Toolset support.

This feature is not available out of the box, not on Toolset, and not even in WordPress. It will need either a 3rd party plugin or some custom code to be implemented.

There is this plugin, but it does not offer to customize the folder by category. https://wordpress.org/plugins/custom-upload-dir/

Or you may try with custom code. I'll share a couple of articles on how to do that:
- https://wordpress.stackexchange.com/questions/180353/change-upload-dir-folder-at-a-certain-cpt-but-cant-change-back
- https://wordpress.stackexchange.com/questions/193089/change-upload-directory-on-custom-plugin-page
- https://wordpress.stackexchange.com/questions/47415/change-upload-directory-for-pdf-files
- http://wordpress.stackexchange.com/questions/76895/different-upload-directory-based-on-post-type-in-a-theme
- http://wordpress.stackexchange.com/questions/95829/set-custom-upload-path-for-custom-post-type-only
- http://wordpress.stackexchange.com/questions/83248/post-type-specific-upload-folder-in-3-5

I hope this answers your question. I'll remain at your disposal.

#2143781

Thanks, looked at this solution which uploads directly to the root "uploads directory" but it also uploads to the media library which we don't want. Ideally want the file uploaded to a sub directory in uploads called "docs" only.

#2143791

When a file is uploaded by Toolset/WordPress, it will always have an entry in Media Library. That's how WordPress uploads works. WordPress creates a new Media/Attachment post for every file uploaded. And Toolset just uses what WordPress offers.

If you want the post to not appear on the Media Library, you need to filter them or exclude them from it. And that will also require custom code. Check an example here https://wordpress.stackexchange.com/a/231201

#2143793

Thank you, how would I target my CPT in the code provided in the link?

#2143891

It is not really a complete working code. It is just for reference, so you can build the code that is relevant to your website.

Check the other reply too. https://wordpress.stackexchange.com/a/231210

However, as I already mentioned in the first reply, custom code is out of the scope of the support. Check our support policy https://toolset.com/toolset-support-policy/

If you are not comfortable with programming, consider hiring a developer. You will find our contractors contact on this page https://toolset.com/contractors/

#2145801

My issue is resolved now. Thank you!