Thread: ftp?!

    #1
  1. No Profile Picture
    wangjun
    Guest
    Devshed Newbie (0 - 499 posts)
    I want to fopen a local file with php program in server.
    The file name is transferred through a form
    ...< input type="file" name="filename"...
    I write the php code like this
    fopen($filename,"r");
    But I cant reach to my expected result.

    So I should use ftp? first, ftp the file form local disk to server, then in server fopen the file. ...
    ( and can i implement it? )
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    43
    Rep Power
    15
    To debug it put some print statements in place:

    print("File Path: $filename<br>n");
    print("File Name: $filename_name<br>n");
    print("File Type: $filename_type<br>n");
    print("File Size: $filename_size<br>");

    That way you know if the file is being uploaded properly. There's other things I don't know if your doing. Put hidden input type called MAX_FILE_SIZE
    <input type="hidden" name="MAX_FILE_SIZE" value="2048000"> for 2 meg max. Don't go over 2 meg.
    before the <input "file" ....
    Also in the form statement do you have ENCTYPE="multipart/form-data" and POST only not GET.
    If your doing all this it should work.


  4. #3
  5. No Profile Picture
    wangjun
    Guest
    Devshed Newbie (0 - 499 posts)
    Thank u lhallusa.
    I'm a new man of PHP.
    So an detailed demo(including some source code) would be important for me.

    ftp functions must be used in PHP4, right?
    Can u tell me how to setup ftp lib in RedHat + Apache.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    43
    Rep Power
    15
    Why does it give an error "Fatal error: Call to unsupported or undefined function ftp_connect()"?
    You failed to compile PHP with the FTP functions. You need PHP 3.0.13 or higher, and you must configure it with the --with-ftp flag. Go to the PHP web site for help with that.

    Found this at: http://www.inebria.com/phpftp/

    hope that helps. The source code is there also which has PHP ftp functions using the phpftp extension.


    ------------------
    lhallusa
    webpatron.com

Similar Threads

  1. ftp problem
    By lieber1 in forum FTP Help
    Replies: 0
    Last Post: November 18th, 2003, 04:08 AM
  2. FTP server problems
    By lnong in forum FTP Help
    Replies: 2
    Last Post: October 27th, 2003, 10:30 AM
  3. FTP Isolation (not using Active Directory)
    By cltatum1 in forum FTP Help
    Replies: 2
    Last Post: October 1st, 2003, 07:22 PM
  4. anonFTP hack?
    By (jp) in forum FTP Help
    Replies: 3
    Last Post: March 10th, 2003, 01:58 PM
  5. Replies: 2
    Last Post: August 12th, 2002, 08:25 AM

IMN logo majestic logo threadwatch logo seochat tools logo