Upload file without using the filepicker

Upload file without using the filepicker

by Joshua Gang -
Number of replies: 4
Background info. We are moving from a third party CMS to moodle. At this point in time we provide all user/course/enrollments to the thirdpaty CMS. In trying to make the Moodle transition as seemless/painless as possible, we are going to try to mimic what we are doing with the third party CMS. So via a cron job we are trying to populate all user/course/enrollment via CSV files. I am trying to get a file into moodle but it seems that everything (at least the objects written in Moodle 2.0) related to file uploads deal with the filepicker object. Can anybody point me into the right direction to be able to upload a file into moodle, ie into the moodledata folder as well as the correct entry into the moodle database. Thanks
La media da valetaziuns: -
In reply to Joshua Gang

Re: Upload file without using the filepicker

by Mary Cooch -
Maletg da 	Documentation writers Maletg da 	Moodle HQ Maletg da 	Particularly helpful Moodlers Maletg da 	Testers Maletg da 	Translators
Hi there
Could you give a clearer example of what you want to do please? On the one hand you are saying in Moodle 2.0 you have to upload via the filepicker but on the other hand you are talking about CSV upload. If you simply want to upload users into Moodle via a CSV file then this is done in Moodle 2.0 via site administration>users>accounts>upload users.
La media da valetaziuns: -
In reply to Mary Cooch

Re: Upload file without using the filepicker

by Joshua Gang -
I am talking about a CSV but upload I guess is a misleading term. I need this to be a behind the scenes cron job not a manual process of using the webpage. And so far everything I have seen in Moodle in getting a file into the moodle data directory as well as the correct row in the database is by using the filepicker object within the server/moodle/repository folder. So my final project would be using SSIS to generate a csv file with all of the users information and then having a cron job read through the file and import/update the user information. I was planning on using the uploaduser.php code (with the reference to the uploaduser_form.php) to read through the csv file and insert new or update existing users.
La media da valetaziuns: -
In reply to Joshua Gang

Re: Upload file without using the filepicker

by Dale Davies -
Rather than attempting to automate an upload it into Moodle using the file API. Could you either save the csv file into a network share accessible by the Moodle web server and read the file in from there using PHP. Or use cURL to read the file from a remote URL, and parse the contents into something usable by the uploaduser.php script.
La media da valetaziuns: -