We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2800
    • 3 Posts
    hi,

    what can I do, when the safe mode is on and not allow upload images?
    any solution?

    here the browser messages:
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 10012 is not allowed to access ....../httpdocs/assets/galleries/3 owned by uid 30	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	....../httpdocs/assets/snippets/maxigallery/maxigallery.php	 
      Line: 	254	 
      Line 254 source: 	move_uploaded_file( $_FILES['file'.$i]['tmp_name'] , $path_to_gal.$name );
    


    thanx barny
      • 263
      • 52 Posts
      Just curious - safe mode on what and where?
        • 7923
        • 4,213 Posts
        You need to use FTP commands to do the uploading, see this thread and try the thing that is at the bottom.


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 10076
          • 1,024 Posts
          is the "fix/suggestion" you refer to implemented in the latest version 0.5?


          Should I fill these lines with my details?

          $mgconfig[’use_ftp_commands’] = (isset($use_ftp_commands)) ? $use_ftp_commands : false; // [ true | false ]
          $mgconfig[’ftp_server’] = (isset($ftp_server)) ? $ftp_server : "www.my.site"; // [ text ]
          $mgconfig[’ftp_port’] = (isset($ftp_port)) ? $ftp_port : 21; // [ number ]
          $mgconfig[’ftp_user’] = (isset($ftp_user)) ? $ftp_user : "username here?"; // [ text ]
          $mgconfig[’ftp_pass’] = (isset($ftp_pass)) ? $ftp_pass : "password here?"; // [ text ]


          and is this bit okay?:

          //processors
          if($_REQUEST[’action’]==’upload_pics’) { //if "upload pictures" has been used
          if(!file_exists($path_to_gal)) {
          if(ini_get(’safe_mode’) == ’Off’)




          if(!$mg->mgconfig[’use_ftp_commands’]) {
          $old_umask = umask(0);
          if(!mkdir($path_to_gal, 0777)) {
          $output = ’Directory creation failed!’;
          return;
          }
          umask($old_umask);
          } else {
          $connect = ftp_connect($mg->mgconfig[’ftp_server’], $mg->mgconfig[’ftp_port’]);
          if (!$connect) {
          $output = ’Connection to FTP failed.’;
          return;
          }
          $login = ftp_login($connect, $mg->mgconfig[’ftp_user’], $mg->mgconfig[’ftp_pass’]);
          if (!$login) {
          $output = ’Could not login to FTP.’;
          return;
          }
          $changeDir = ftp_chdir($connect, ’/’.$path_to_galleries);
          if (!$changeDir) {
          $output = ’Could not change directory to: /’.$path_to_galleries;
          return;
          }
          $makeDir = ftp_mkdir($connect, $pageinfo[’id’]);
          if (!$makeDir) {
          $output = ’Could not created directory.’;
          return;
          }
          $old_umask = umask(0);
          $setPerm = ftp_site($connect, ’CHMOD 0777 /’.$path_to_galleries.$pageinfo[’id’].’/’);
          if (!$setPerm) {
          $output = ’Could not set permissions: ’.’CHMOD 0777 /’.$path_to_galleries.$pageinfo[’id’].’/’;
          }
          umask($old_umask);
          ftp_close($connect);

          I did these modifications but this is the error I get trying to upload images:

          « MODx Parse Error »
          MODx encountered the following error while attempting to parse the requested resource:
          « PHP Parse Error »

          PHP error debug
          Error: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 1238 is not allowed to access /workdisk/home/web/www.smashit.it/htdocs/assets/galleries/23 owned by uid 1000
          Error type/ Nr.: Warning - 2
          File: /workdisk/home/web/www.smashit.it/htdocs/assets/snippets/maxigallery/maxigallery.php
          Line: 370
          Line 370 source: move_uploaded_file( $_FILES[’file’.$i][’tmp_name’] , $path_to_gal.$name );


          What did I do wrong here?
            • 7923
            • 4,213 Posts
            In the snippet call, use: &use_ftp_commands=`1` &ftp_server=`serveraddress` &ftp_port=`portnumber` &ftp_user=`username` &ftp_pass=`password`


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 10076
              • 1,024 Posts
              Thanks for that call. So I dont edit the maxigallery.php?
              Anyway tried all possible, with my ISP it does not function. on my local XAMPP, same site almost same config, it does.

              Safe mode is of in my php so. I ll see what happens when the site goes to the desination ISP.
              Anyway it looks and works very nice. Thanks for this great snippet,

              best Frank.
                • 7923
                • 4,213 Posts
                Yea, your ISP has the strangest settings I’ve seen, probably misconfigured.. I’m not able to help any better than to suggest to change isp.


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 7923
                  • 4,213 Posts
                  Is modx installed to your FTP root?


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 10076
                    • 1,024 Posts
                    Its in the htdocs. Which is my webroot. So not in htdocs/modx. But it looks like htdocs/assets or for example htdocs/manager.
                      • 7923
                      • 4,213 Posts
                      Umm.. where did the post go from above my latest reply? In anycase, that post had the error message that it could not change to the assets/galleries folder and that can happen if modx is not in your ftp root, I’ll need to add another parameter where you can define where modx is from the ftp root. But as a quick fix, you can change in maxigallery.php:

                      ftp_chdir($connect, ’/’.$path_to_galleries);

                      to

                      ftp_chdir($connect, ’/htdocs/modx/’.$path_to_galleries);

                      eg. tell the script where to go from ftp root to modx folder.


                        "He can have a lollipop any time he wants to. That's what it means to be a programmer."