I am getting same error but at the time of uploading file from student account.
Error is like:-
ERROR: Could not find or create a directory (/var/www/moodledata/3)
Only thing i have done is ; change the owner of the moodledata folder.
#chown -R apache moodledata
Now student's of my moodle can upload files for their assingment.
Thanks for your help, because it their in your steps, you follow previously.