SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict heropage's Avatar
    Join Date
    May 2004
    Location
    canada
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rename Operation not permitted

    After I upload file to tmp directory,
    I use
    Code:
    rename("/tmp/EkCN3GPzKh","/home/virtual/site3/fst/var/www/html/video/77.avi")
    to rename.


    But there is an error:
    rename(/tmp/EkCN3GPzKh,/home/virtual/site3/fst/var/www/html/video/77.avi) [function.rename]: Operation not permitted in
    /home/virtual/site3/fst/var/www/html/rename.php on line 1

    I have check the file permission
    Code:
    -rw-------  1 admin3 admin3 272836 Dec 24 03:06 EkCN3GPzKh

  2. #2
    SitePoint Addict
    Join Date
    Sep 2005
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    move_uploaded_file();
    PHP Shopping Cart Software Easy Ecommerce Shopping Cart Script.
    PHP Super Cart is 100% template driven.

  3. #3
    SitePoint Addict heropage's Avatar
    Join Date
    May 2004
    Location
    canada
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jondolar View Post
    Try
    move_uploaded_file();
    Doesn't work!

  4. #4
    SitePoint Addict heropage's Avatar
    Join Date
    May 2004
    Location
    canada
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if I use copy

    copy(/tmp/EkCN3GPzKh) [function.copy]: failed to open stream: Permission denied

  5. #5
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That'd be the permission on /tmp directory.
    like jondolar said, use move_uploaded_file.

    You said, you get an error, what is the error?
    ---------------------------
    Errors = Improved Programming.
    My Site

  6. #6
    SitePoint Addict heropage's Avatar
    Join Date
    May 2004
    Location
    canada
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana View Post
    That'd be the permission on /tmp directory.
    like jondolar said, use move_uploaded_file.

    You said, you get an error, what is the error?
    Not error, it return false.

    I feel the same way, it should something to do with the /tmp permission.
    it's a dedicated server.
    I was mounted before.
    I umount it.

  7. #7
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, the permissions on /tmp directory are not normal.

    Post that bit of code here , just in case it is something to do with code.

    Also, make sure, the directory TO WHICH you are uploading has "w" permission.

    Remember sometimes, you have to have permissions like

    rwx-wx-wx , yes even to users, i dont know why but it was the error once.
    ---------------------------
    Errors = Improved Programming.
    My Site

  8. #8
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana View Post
    rwx-wx-wx , yes even to users, i dont know why but it was the error once.
    when php runs as an apache module(most common) it usually runs as the "nobody" user. this is why such loose permissions are needed under this enviornment.

    and of course, this can be pretty bad for security.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •