• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
uploading files outside the root folder

hello everyone ... below is a sample of code i use for uploading images to a gallery in my application ... just for improved secirity i decided that i should upload the files to another folder outside my root directory ... anoda folder in my www .... i specified the full file path to the directory where it should uploaad to but that is where the error started .... it did not work ... would appreciate it if sum1 helped me with this

         /*the directory for uploading the drawing file*/
              $dir = "./gallery/safe/";
//(for uploading out side the root folder i specified this path http://folder_outside_root_folder/gallery/safe)
              /*preparing the config settings for upload */
        /*renamin the file with random encryptions*/      
              $config['file_name'] = $new_name; // the new file name the image should have
              $config['upload_path'] = $dir; // the directory the image should go to,already specified
              $config['allowed_types'] = 'gif|jpg|png'; // the file types that are allowed
              $config['max_size']    = '10000'; //the maximum image size
              $config['max_width']  = '0'; //the maximum image width
              $config['max_height']  = '0'; // the maximum image height

              $this->load->library('upload', $config); // retrieving the upload library with the specified settings

              /*using the do upload settings upload the file if it fails stop upload and show errors*/
          if(! $this->upload->do_upload("drawing_file"))
          $data["msg"] = $this->upload->display_errors();;

Two basic things to check first:
- echo $dir to make sure that it is actually the directory you intended.
- does apache or php have permission to write files in that directory?

This has already be solved in another thread he posted twice in two different places!

and the answer was


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.