Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Safe mode enabled

Options
  • 21-05-2006 1:48pm
    #1
    Registered Users Posts: 1,667 ✭✭✭


    Hi

    I have installed RoundCube webmail client for a website on a php safe mode enabled server. Everything is working good so far except attachment. The script/function won't work due to safe mode restriction i.e. different owner/group id in folder/files created by the script/function. These are the scripts that I hopefully can change to make things work :
    // create temp-dir for uploaded attachments
      if (!empty($CONFIG['temp_dir']) && is_writeable($CONFIG['temp_dir']))
        {
        mkdir($temp_dir, 0777);
        $_SESSION['compose']['temp_dir'] = $temp_dir;
    

    The second one has move_uploaded_file function which won't work with safe mode on.
    $response = '';
    
    foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath)
      {
      $tmpfname = tempnam($temp_dir, 'rcmAttmnt');
      if (move_uploaded_file($filepath, $tmpfname))
        {
        $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i],
                                                      'mimetype' => $_FILES['_attachments']['type'][$i],
                                                      'path' => $tmpfname);
    
        $response .= sprintf("parent.%s.add2attachment_list('%s');\n", $JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i]);
        }
      }
    

    I am thinking of coding script to ftp, not sure how does it work really and how safe is it going to be, having ftp logins in the script file.

    Comments and suggestions are always welcome. Thanks.

    Mart


Advertisement