1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Rep Power
    Hi everybody,

    I have the following problem, I have a database (MySQL) in which I can store filenames, in my script I can select a file from my hard drive that will be uploaded and stored in a directory on the server. So far so good.

    Now when I want to replace the file by another one and use the same script it won't replace the file. Does anybody outthere know what the problem might be??

    The following code is my part of the script that does the uploading:

    if ($img1_name != "") {

    copy("$img1", "/home/sitename/www/dbasepictures/$img1_name") or die ("Couldn't copy the file!");

    } else {

    die("No input file specified");

    Thanks a lot in advance!!


  2. #2
  3. No Profile Picture
    Carpe Diem
    Devshed Newbie (0 - 499 posts)
    Try unlinking it first something like

    should do the trick (Or code to that effect), also don't forget that the chances are the file is owned by the web server user (nobody ot httpd normally) so check permissions etc....

    The user wont be able to remove a file that is owned by someone else


    http://www.php4hosting.com/ $
    http://www.php4hosting.co.uk/ £
    PHP/MySQL Enabled Hosting/Dedicated Servers

Similar Threads

  1. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 08:27 AM
  2. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 06:06 AM
  3. Replies: 1
    Last Post: February 8th, 2004, 01:59 PM
  4. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 07:42 PM
  5. Simple find and replace word search for a text file with php?
    By rabid lemming in forum PHP Development
    Replies: 4
    Last Post: February 1st, 2004, 09:37 PM

IMN logo majestic logo threadwatch logo seochat tools logo