Fin
uploaded file permissions are wrong
  • Envoyé: 28.02.2006, 22:15
    Invité
    rang:
    1
    enregistré depuis:
     décembre 2003
    Status:
    hors ligne
    dernière visite:
    06.03.05
    Messages:
    0
    when I try to upload a pic with pnavatar, the file permissions are set to 600 rather then 644. Is there a way to change that?
  • Envoyé: 08.05.2006, 23:02
    Invité
    rang:
    1
    enregistré depuis:
     décembre 2003
    Status:
    hors ligne
    dernière visite:
    06.03.05
    Messages:
    0
    I'm having the same problem. Any help?
  • Envoyé: 09.05.2006, 17:48
       
    vedrine
    rang:
    Site Admin Site Admin
    enregistré depuis:
     décembre 2003
    Status:
    hors ligne
    dernière visite:
    12.05.08
    Messages:
    257
    php has a chmod function.
    The syntax is
    Code
    chmod(string filename, int mode );
    the function return true if it succed in executing the chmod command and false if it don't. But the important thing is that mode shoud be written in octal notation so you should use 0644 not 644. So I suggest in pnuser.php to change
    Code
    if (!move_uploaded_file($uploadfile['tmp_name'], "$pathavatar/pers_$uid.$ext")) {
        $err=6;
    }
    if ($pathphpbb!=''){
        if (!move_uploaded_file($uploadfile['tmp_name'], "$pathphpbb/pers_$uid.$ext")) {
            $err=7;
        }
    }
    to:
    Code
    if (!move_uploaded_file($uploadfile['tmp_name'], "$pathavatar/pers_$uid.$ext")) {
        $err=6;
    } else chmod("$pathavatar/pers_$uid.$ext", 0644);
    if ($pathphpbb!=''){
        if (!move_uploaded_file($uploadfile['tmp_name'], "$pathphpbb/pers_$uid.$ext")) {
            $err=7;
        } else chmod("$pathphpbb/pers_$uid.$ext", 0644);
    }

    Please note that this is untested code becaus eI don't have this problem wich should be largely dependant of your server's php setup.
    If you test it, please report here if it works or not.
  • Envoyé: 10.05.2006, 03:16
    Invité
    rang:
    1
    enregistré depuis:
     décembre 2003
    Status:
    hors ligne
    dernière visite:
    06.03.05
    Messages:
    0
    That seems to be the fix. Thanks!
Réponse rapide
 
  • Options
Code:
Couleur de la police:  
Taille de la police: