Problem in file permission

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vivekgs2007
    New Member
    • Mar 2010
    • 62

    Problem in file permission

    Hi to all,
    I created a php file, Where the files are uploaded in to a folder. When i am assessing to that file, it is showing 404 forbidden error, I got the error,It is in file permission of the folder, so i changed the permission to 777, I want to change the permission dynamically, when ever i upload the new file, it must change to 777.
    i used this code
    Code:
     
     $photo = $_FILES['photo']['name'];
      $photo = chmod($photo,777)     move_uploaded_file($_FILES["photo"]["tmp_name"],"project_photo/".$_FILES["photo"]["name"]);
    but it is not displaying the photo.
    Please help me in this.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    I see three problems there:
    1. You are calling the chmod on the wrong path. You need to call it on the exact path where your file is saved, not just on the file's name.
    2. The file must be created before you try to change it's permission.
    3. The chmod function returns a boolean, not a file path. You should use it to check whether the file was successful or not. (See the documentation.)

    Fix these first and then see what happens.

    Comment

    • vivekgs2007
      New Member
      • Mar 2010
      • 62

      #3
      Hi Sir,
      Thank You very Much...I am very Greatfull to you...U have saved me...I got the answer...
      Check this site http://www.eitech.in/prj_project.php?value=1

      Comment

      Working...