admin管理员组

文章数量:1202371

I have installed wordpress plugins Real Media library, Real Physical Media, and Media file renamed. Using this I am able to physically move images and organize images in the upload folder as per categories. Both these plugins have API - .html .html

but they don't seem to provide any option to upload files.

It means for uploading I still need to use the classic Wordpress rest API. So how do I then physically move the files, do I upload using classic way, and the images get uploaded in the date file structure format, and use a second API call to move those uploaded images? Or directly while uploading itself I can set the destination folder.

I have installed wordpress plugins Real Media library, Real Physical Media, and Media file renamed. Using this I am able to physically move images and organize images in the upload folder as per categories. Both these plugins have API - https://docs.devowl.io/real-media-library/api/index.html https://docs.devowl.io/real-physical-media/api/index.html

but they don't seem to provide any option to upload files.

It means for uploading I still need to use the classic Wordpress rest API. So how do I then physically move the files, do I upload using classic way, and the images get uploaded in the date file structure format, and use a second API call to move those uploaded images? Or directly while uploading itself I can set the destination folder.

Share Improve this question asked Feb 26, 2022 at 6:02 Sri Nithya SharabheshwaranandaSri Nithya Sharabheshwarananda 1113 bronze badges 3
  • What have you tried? – Tony Djukic Commented Feb 28, 2022 at 17:40
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Bot Commented Feb 28, 2022 at 17:40
  • @TonyDjukic - I have not even tried it yet. I had to move to another project before I could try something out. But I played with the API a bit, it looks like I need to upload like any other ordinary file, and then move it to the specific folder using the WP plugins I mentioned. I just wanted to know if the WP API directly had something which I might not be aware of. – Sri Nithya Sharabheshwarananda Commented Mar 3, 2022 at 6:47
Add a comment  | 

1 Answer 1

Reset to default 0

The problem is solved. Actually in the regular Wordpress API for uploading media wp/v2/media please add one more form data entry rmlFolder: <the_id_of_destination_folder> That is all, it gets uploaded in the correct folder.

I am posting my code (in Java based on a library not written by me)

After the patch

本文标签: media libraryHow to upload images in a specific folder using API