Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ftp+php

ftp+php

Scheduled Pinned Locked Moved Web Development
phptutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rgoyal
    wrote on last edited by
    #1

    Can anyone give me a simplest possible example for using ftp with php technology? I will be very much thankful. Ranjan Goyal

    R 1 Reply Last reply
    0
    • R rgoyal

      Can anyone give me a simplest possible example for using ftp with php technology? I will be very much thankful. Ranjan Goyal

      R Offline
      R Offline
      raouls
      wrote on last edited by
      #2

      look in the php manual. the best documentation i have ever seen. -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298

      R 1 Reply Last reply
      0
      • R raouls

        look in the php manual. the best documentation i have ever seen. -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298

        R Offline
        R Offline
        rgoyal
        wrote on last edited by
        #3

        I want a very basic working example. e.g Reading a file from remote machine, displaying it on my textbox and then on a button click to save that file in the same place. At present I am not able to read file. My machine no is 192.168.0.6 Below is the code that I am using "; $fp=fopen("ftp://\*\*\*\*\*\*:\*\*\*\*\*@192.168.0.60/ranjan/downDb.php",r); $contents = fread ($fd, 100);//100 is file size here echo"$contents"; echo""; ?> Below is the error generated Warning: fopen(ftp://...@192.168.0.60/ranjan/downDb.php): failed to open stream: FTP server reports 550 Could not get file size. in /home/small_projects/ranjan/ftp.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in /home/small_projects/ranjan/ftp.php on line 4

        R 1 Reply Last reply
        0
        • R rgoyal

          I want a very basic working example. e.g Reading a file from remote machine, displaying it on my textbox and then on a button click to save that file in the same place. At present I am not able to read file. My machine no is 192.168.0.6 Below is the code that I am using "; $fp=fopen("ftp://\*\*\*\*\*\*:\*\*\*\*\*@192.168.0.60/ranjan/downDb.php",r); $contents = fread ($fd, 100);//100 is file size here echo"$contents"; echo""; ?> Below is the error generated Warning: fopen(ftp://...@192.168.0.60/ranjan/downDb.php): failed to open stream: FTP server reports 550 Could not get file size. in /home/small_projects/ranjan/ftp.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in /home/small_projects/ranjan/ftp.php on line 4

          R Offline
          R Offline
          raouls
          wrote on last edited by
          #4

          from the php manual: -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298

          R 1 Reply Last reply
          0
          • R raouls

            from the php manual: -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298

            R Offline
            R Offline
            rgoyal
            wrote on last edited by
            #5

            Hi Raoul, First very sorry for this delayed response. Today, I tried the following code and I got the following error: Fatal error: Call to undefined function: ftp_connect() in /home/small_projects/ranjan/ALLFILES/ftp.php on line 12 192.168.0.112 is IP of a folder on NT server Code is this: // set up basic connection $ftp_server="http://192.168.0.112/Ranjan"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name="********"; $ftp_user_pass="********"; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } Ranjan

            R 1 Reply Last reply
            0
            • R rgoyal

              Hi Raoul, First very sorry for this delayed response. Today, I tried the following code and I got the following error: Fatal error: Call to undefined function: ftp_connect() in /home/small_projects/ranjan/ALLFILES/ftp.php on line 12 192.168.0.112 is IP of a folder on NT server Code is this: // set up basic connection $ftp_server="http://192.168.0.112/Ranjan"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name="********"; $ftp_user_pass="********"; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } Ranjan

              R Offline
              R Offline
              raouls
              wrote on last edited by
              #6

              > // set up basic connection > $ftp_server="http://192.168.0.112/Ranjan"; > $conn_id = ftp_connect($ftp_server); first problem i see is that "http://" - remember, you are trying to connect to an FTP server... not an HTTP server... try changing that and see what you get... -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups