Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Web services files handling: Difference between revisions

From MoodleDocs
 
Line 4: Line 4:
The client sends the FILES by HTTP calling webservice/upload.php with the web service token.
The client sends the FILES by HTTP calling webservice/upload.php with the web service token.


The upload script stores the files in a draft area. It send back the draft aera id to the client in JSON format.
The upload script stores the files in a draft area. If the itemid in the request is missing or is 0, a new draft area will be created. It send back the draft area id to the client in JSON format.
 
The files, that a user can send, have the same restriction (number of files, max size...) as if the user were using the web interface.


2- The  client calls the web service function. It sends as many draft area ids as it is requested by the web service function.  
2- The  client calls the web service function. It sends as many draft area ids as it is requested by the web service function.  
Line 13: Line 11:


Note: in Moodle web service structure, we need to add a new param for draft id when dealing with textarea/description/introeditor.
Note: in Moodle web service structure, we need to add a new param for draft id when dealing with textarea/description/introeditor.
Note: core_user_add_user_private_files will copy files from a draft area to a users private files area and (applying any file restrictions).

Latest revision as of 06:07, 12 August 2013

Proposal for sending file from the client to Moodle

1- The client calls webservice/pluginfile.php

The client sends the FILES by HTTP calling webservice/upload.php with the web service token.

The upload script stores the files in a draft area. If the itemid in the request is missing or is 0, a new draft area will be created. It send back the draft area id to the client in JSON format.

2- The client calls the web service function. It sends as many draft area ids as it is requested by the web service function.

Texts sent by the client should contain @@pluginfile....@@ strings to reference the files.

Note: in Moodle web service structure, we need to add a new param for draft id when dealing with textarea/description/introeditor.

Note: core_user_add_user_private_files will copy files from a draft area to a users private files area and (applying any file restrictions).