[Resolved] I am trying to upload file to custom path
This support ticket is created 6 years, 12 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I am trying to:
I am trying to setup a custom location and path to upload files. I am using the code here to drive the path hidden link
After implementing this code if I upload a file on a form in the wordpress admin it upload to the correct path as dictacted by the customer upload directory above.
The problem is when I try to upload from within the cred form. When I do it from the cred form it creates the folder correctly but it uploads the files to the default wordpress location. year/month etc.
Please advise what is required to get this to work.
Thanks
Oliver
Hello. Thank you for contacting the Toolset support.
Well - CRED uses internally wp_handle_upload WordPress API function and is getting the info about where upload files are with other API function wp_upload_dir() so we are following precisely the right way to handle the process.
=> https://codex.wordpress.org/Function_Reference/wp_handle_upload
The function expects the upload_dir value to be the default one, or alternatively, to be notified about the new upload directory path(s).
"This hook allows you to change the directory where files are uploaded to. The keys and values in the array are used by the wp_upload_dir function in WordPress core, which is doing the work."
question is when to took exactely for ajax-upload and normal upload.
cred_before save_data for setting filter "upload_dir" and unfilter in "cred_save_data"?