Hello everyone,
I am trying to use api explorer to upload multiple images using the code below in api.json in Trongate_filezone.
Question one: how can i access trongate_filezone api.json in api explorer and upload files using the api version of trongate.
question two: i am trying to access the api explorer using sample url: http://localhost/{proj_name}/api/explorer/trongate_filezone/upload/photos_module/2 so am i doing it right.
Thanks everyone in advance.
Multi-File Uploaders on API Explorer
3 years ago
3 years ago
#1
3 years ago
#2
Hi Evance,
You can't use the API Explorer this way - the Trongate_filezone is a bit more complicated than what you may be thinking.
Answer to question 1 - the API Explorer looks for a table of the same name as your module - in this case, there is no table and you will get an error saying so. However, you can fool it by creating a dummy table like so:
then you can go to it with this URL:
but you will find it won't behave how you think it should. If you follow the logic in Trongate_filezone.php and look at the upload() method, you will see that in the private method of _do_upload() you need to have the $_FILES [] array set - which is all tide into the multi_picture uploader. I would suggest you look through the code of a module that has that applied so you can learn more about how it is done.
Answer to question 2 - No that won't work as it will ignore segments 3 & 4 of the URL
You can't use the API Explorer this way - the Trongate_filezone is a bit more complicated than what you may be thinking.
Answer to question 1 - the API Explorer looks for a table of the same name as your module - in this case, there is no table and you will get an error saying so. However, you can fool it by creating a dummy table like so:
then you can go to it with this URL:
but you will find it won't behave how you think it should. If you follow the logic in Trongate_filezone.php and look at the upload() method, you will see that in the private method of _do_upload() you need to have the $_FILES [] array set - which is all tide into the multi_picture uploader. I would suggest you look through the code of a module that has that applied so you can learn more about how it is done.
Answer to question 2 - No that won't work as it will ignore segments 3 & 4 of the URL