Uploading Student Pics...

Uploading Student Pics...

by Jim Hale -
Number of replies: 7

Now that I have the *BIG* 'files' problem fixed - this one should be a breeze. Mamatheka

I try to upload a pic into my profile, nothing gets uploaded. No errors, no nothing. I know php uploading works because I can (now) upload files into classes, I also run Gallery and can upload there. According to the Moodle config screen, I DO have GD installed (albeit 1.x).

Where is the pic supposed to go?

Thanks! Mamatheka

Average of ratings: -
In reply to Jim Hale

Re: Uploading Student Pics...

by Ray Kingdon -
The user pics go into $CFG->dataroot/users/id. For example on my installation a user with an ID number of 3 has two files in /var/moodledata/users/3. The files are f1.jpg and f2.jpg Vica
In reply to Ray Kingdon

Re: Uploading Student Pics...

by Jim Hale -

Thanks for the response Ray! Mamatheka

I just checked under that directory and moodle is creating folders and such for the individual classes to store their data, but nothing regarding the users is going in there...

I even tried to manually create a 'users' folder under the data folder, set the R/W to all and it still won't upload the student pic. I still don't get any kind of error - just no pic. :/

In reply to Jim Hale

Re: Uploading Student Pics...

by Ray Kingdon -
The error MAY still be permissions (they're a pain Vica ) Try putting a delay on the redirect statements in mod/user/edit.php file. They're around lines 93 and 95 in my version of the fine. The delay is the (missing) last parameter, that is change the ); to something like ,30); That will give a delay of 30 seconds before the screen refreshs.

Any error messages you get from trying to create subdirectories and files should yet been seen for the 30 seconds. Otherwise they appear and disappear pretty quickly.

Good Luck!
In reply to Ray Kingdon

Re: Uploading Student Pics...

by Jim Hale -

Are you talking about these 2 lines?

redirect("view.php?id=$user->id&course=$course->id", get_string("changessaved"),15);

redirect("../admin/user.php", get_string("changessaved"),15);

(I add the ,15) - I found them in the edit.php under /user. I couldn't find a /mod/user folder.

If these are the correct lines, it still went to 'Changes Saved' without any errors. Phatheka kabi

In reply to Jim Hale

Re: Uploading Student Pics...

by Jim Hale -

ONE of these days I'll remember to look at the server logs... Mamatheka

This is what my server is reporting...

Mar  6 19:00:01 SME-Server56 sshd(pam_unix)[2209]: session opened for user root by (uid=0)
Mar  6 19:02:16 SME-Server56 httpd: PHP Warning:  open_basedir restriction in effect. File is in wrong directory in [masked for security]/user/lib.php on line 63
Mar  6 19:02:16 SME-Server56 httpd: PHP Warning:  getimagesize: Unable to open '/tmp/phpldHJxv' for reading. in [masked for security]/user/lib.php on line 63

 

Any thoughts? Mamatheka

 

In reply to Jim Hale

Re: Uploading Student Pics...

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
"Warning: open_basedir restriction in effect."

This means that your PHP server has been restricted in where it can write files. The temporary directory where uploaded files are saved is outside the area you are allowed to access. (Look in the PHP documentation for safe mode - eg http://www.php.net/manual/en/features.safe-mode.php)

You have to find a way to either turn off the open_basedir restriction or move the temporary upload directory somewhere into your accessible space.
In reply to Ray Kingdon

Re: Uploading Student Pics...

by Greg Barnett -
My comment probably fits better in the developers forum, but since it fits the discussion, I thought I'd mention it here. What does everyone think about a slight modification to the redirect function, that makes sure that the user has an opportunity to see any message before being redirected? My suggestion is this (first few lines are different).


function redirect($url, $message="", $delay=false) {
// Uses META tags to redirect the user, after printing a notice
if(!empty($message) && $delay == false):
$delay = 10;
elseif($delay == false):
$delay = 0;
endif;
.... rest of function the same