Renaming user uploaded file

Discussion in 'PHP' started by Cinta April, May 1, 2008.

  1. #1
    Hi I when a user upload a file to my website i can't rename it, but when i upload a file directly using ftp i can rename it using rename(). What is wrong?
     
    Cinta April, May 1, 2008 IP
  2. graham23s

    graham23s Well-Known Member

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #2
    can you show us your upload code?

    Graham
     
    graham23s, May 1, 2008 IP
  3. Cinta April

    Cinta April Banned

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    move_uploaded_file()
    after i upload the file i chmod() it to 0777 but itstill isn't working. it is working perfectly on my local computer.
     
    Cinta April, May 1, 2008 IP
  4. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #4
    You shouldn't need to chmod it to be able to rename it.

    Just insure that httpd process has file edit privileges to such folder you are storing the files in.

    What system/control panel are you using?

    Peace,
     
    Barti1987, May 1, 2008 IP
  5. Cinta April

    Cinta April Banned

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ok it turns out that nothng is wrong just the browser settings. someone ought to make a better browser. anyway try out my new website and see if there is any security hole in my sig.
     
    Cinta April, May 1, 2008 IP
  6. ksamir2004

    ksamir2004 Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi Chinta,

    can you let me know, u want to rename file while uploading in server right?

    Thanks
    Sam
     
    ksamir2004, May 1, 2008 IP
  7. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #7
    Browser settings makes absolutely no sense in terms of why you wouldn't be able to rename an uploaded file.
     
    joebert, May 3, 2008 IP
  8. Cinta April

    Cinta April Banned

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    yes when i switch a picture's name a browser remembers the old address and tends to display the old file. i thought ther's something wrong with my code. i manage to get around it though.
     
    Cinta April, May 3, 2008 IP
  9. ksamir2004

    ksamir2004 Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yes, i also gone through this type of problem.. you ca do one thing when you are uploading file to your server or database store file name in string.
    php script
    This Script will work fine. if you want to rename file while uploading let me know.

    Visit Here http://forums.digitalpoint.com/showthread.php?t=791354
     
    ksamir2004, May 7, 2008 IP