Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Safe mode enabled

  • 21-05-2006 01:48PM
    #1
    Registered Users, Registered Users 2 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