Upload, in php, zip files to user accounts

Upload, in php, zip files to user accounts

by Florin Go -
Number of replies: 1

Hi! I don't know if this is the correct place to ask, so I apologize beforehand.

I want to upload a file programmatically, to the private files area, on any given account (via the said account email). This part of code will reside in plugin that gets installed in the local area.

The solutions that I found either want a session key, webservice or a token.

Is there a proper / simple way to do it?

I must have overlooked, in the documentation, where this could be done, so any pointer will help.


Thank you



Average of ratings: -
In reply to Florin Go

Re: Upload, in php, zip files to user accounts

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
I would use an external service plugin (webservice) using a token. Uploading files via External services is a two-step process generally :

1. Upload the file to a draft area and receive an itemid;
2. Use the itemid to call the main functionality to move the file from the draft area to the user's file area.

There Is a way to avoid the 2 steps but it involved dealing with $_FILES directly - not recommended.

Cheers
Average of ratings: Useful (1)