Best practice forum (Archived)

USER CSV upload

 
Kyle Egan
USER CSV upload
by Kyle Egan - Wednesday, 26 September 2012, 5:27 PM
 

Hi, I'm trying to upload a csv with the following fields (see below) using the

upload users functionality: moodle/admin/tool/uploaduser/index.php

I have done this before in moodle with success and I have tryed removing the Totara fields 'posnumber' , 'postitle' and 'orgidnumber' and it works.

Am I missing something?

Here is the fields im using:

username firstname lastname email posidnumber postitle orgidnumber

I have reviewed:

http://help.totaralms.com/CSV_Files.htm

and the moodle CSV help doc.

I get the generic error:

Error occur during loading CSV file!

More information about this error

Stack trace:
  • line 435 of \lib\setuplib.php: moodle_exception thrown
  • line 121 of \admin\tool\uploaduser\index.php: call to print_error()

 

? ?
Re: USER CSV upload
by ? ? - Wednesday, 26 September 2012, 6:00 PM
 

Hi Kyle,

A couple of potential issues spring to mind

1) Check the CSV file is well-formed with the correct number of records on each line.

3) Check your PHP configuration in case file uploads are not configured correctly. From INSTALL.txt:

8. Setting PHP variables
   There are some PHP configuration variables that may need to be customised, depending on your needs. The variables that are commonly changed
   include "memory_limit", "upload_max_filesize", "post_max_size", "max_input_vars" and "upload_tmp_dir".

   memory_limit - This will need to be increased for restoring large course backups or unzipping large files within Totara
   upload_max_filesize - This setting in conjuction with "post_max_size" will determine how high you can set the max upload size within Totara
   max_input_vars - This setting will need to be increased to a minimum of 2000 if you would like to customise any of the Totara language packs.
   upload_tmp_dir - Some customers may wish to enable this setting and specifically set a directory where files are temporarily stored during the upload process.
 Note the web server user must have permissions to write files in this directory, or all file uploads will fail.

   These settings are all located in php.ini. See http://php.net/manual/en/ini.core.php for more information (note that you will need to restart your
   webserver for these settings to take effect).

If your CSV file is very large you may need to raise the settings in "upload_max_filesize" and "post_max_size". Also check the upload_tmp_dir is writable by the web server.

Finally you could turn on debugging and see if you get more detailed error messages which might narrow down the exact problem:

Site Administration -> Development -> Debugging page, set "Debug messages" dropdown to DEVELOPER and check the "Display debug messages" checkbox, then try to upload the CSV file again. Remember to turn set Debug messages back to NORMAL once you have a screenshot of the detailed error message.

Hope this helps

Kyle Egan
Re: USER CSV upload
by Kyle Egan - Wednesday, 26 September 2012, 10:03 PM
 

Hi Ciaran,

Thanks for the reply, I plugged a few empty fields I had and now I get the error: "posidnumber" is not a valid field name

I checked: http://help.totaralms.com/CSV_Files.htm

and seems like it is correct.

me
Re: USER CSV upload
by George Angus - Wednesday, 26 September 2012, 6:22 PM
Group Totara

Hi Kyle,

Id make sure your data is clean ie no extra or hidden data/characters. Also there are 9 manditory User fields specified on the help page, or at least theyre not optional.

cheers,

George,

Kyle Egan
Re: USER CSV upload
by Kyle Egan - Wednesday, 26 September 2012, 10:07 PM
 

Ok so are you saying that city, country, city, delete and time modified are now mandatory? Just because in Moodle they are not.

Moodle: http://docs.moodle.org/22/en/admin/tool/uploaduser/index

  • Required fields:

username, firstname, lastname, email

naama
Re: USER CSV upload
by Marjaana Jokinen - Wednesday, 26 September 2012, 10:38 PM
 

Hi,

Just a quick note: the path on the help page you posted points to: Home > Totara Sync > CSV Files.

These are mandatory fields for Sync files in 2.2 but if you're looking to just upload a bunch of users in the normal (Moodle) way, please check: Home > Users > Accounts > Add/Edit users instead.

You're right that this latter method only requires the fields you listed above.

If this still doesn't give you the right info, I would check that the csv source data is clean and does not contain any extra characters.

Hope this helps!

br,
Marjaana

Kyle Egan
Re: USER CSV upload
by Kyle Egan - Thursday, 4 October 2012, 11:04 PM
 

Hi, I got the sync working as in it said it was successfuly uploaded although it did not update the users data. I'm assuming that the 'file directory' is not quite right. 

The documentation says:

A file directory must be entered in the provided field and indicates the directory in which the CSV file is to be uploaded. This will likely take the format: /var/lib/moodledata/totarasitename/sync

Is this meant to be a random directory or point to somewhere meaningful?

Regards,

KE

 

Kyle Egan
Re: USER CSV upload
by Kyle Egan - Thursday, 4 October 2012, 11:13 PM
 

Sorry diden't read this, listed below the sync users field:

NOTE: A pending sync file exists. Uploading another file now will overwrite the pending one.

I have run the cron and i'm still getting this message.

This forum post has been removed
Friday, 5 October 2012, 5:11 AM
The content of this forum post has been removed and can no longer be accessed.
Kyle Egan
Re: USER CSV upload
by Kyle Egan - Sunday, 7 October 2012, 8:54 PM
 

Ok Great, well I assume then that the cron just picks up this location and updates the records.

So I have run the Cron but i'm still getting:

NOTE: A pending sync file exists. Uploading another file now will overwrite the pending one.

any thoughts?