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

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    Opening a file using:

    fopen( "username assword@ftp://www.site.com", "w" );

    opens a file without any probelems. But when I try to write to the same file again it won't open the file (get an error, "file already exists")

    What I'm looking for is either how to successfully re-open a file through FTP or how to delete a file using PHP
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Helden,Limburg,The Netherlands
    Posts
    33
    Rep Power
    16
    Hi,

    The problem could be that your script still did not close the file, and that it is still open and as you try to open it again you get an error. Or it could be that the "w" (for write) has to be replaced another letter that means append (I am not sure if that was "a" or "w+")

    Hope this helps,


    ------------------
    Ramon Litjens
    Boradoli Web Design
    (www.boradoli.nl)
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    Klein landje, Nederland ;-)

    Anyway, I fixed the problem. It wasn't that the file wasn't closed yet, it's just not possible in PHP to overwrite a file using PHP3. I fixed it by using the FTP-module in PHP. I'm using a Win32 server to test on, there it was a matter of loading the module "php3_ftp.dll". On the server that runs Unix it's done differently, but it's the same principle.

    You'll need PHP 3.0.16 or later to do this. the earlier versions don't have FTP-support. Run phpinfo() to see what version you're running

Similar Threads

  1. Replies: 3
    Last Post: February 17th, 2004, 11:08 AM
  2. writing a file to a ftp server
    By buddinghere in forum FTP Help
    Replies: 1
    Last Post: February 12th, 2004, 11:36 AM
  3. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 09:27 AM
  4. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 07:06 AM
  5. Executing an exe file via FTP
    By newbuser in forum FTP Help
    Replies: 1
    Last Post: February 8th, 2004, 11:16 AM

IMN logo majestic logo threadwatch logo seochat tools logo