one problem, the ftp functions that you are trying to use are on the server. therefor you are trying to connect one "server" to another "server". you are not connecting from your workstation to the remote server. for what you are attempting to do, ftp will not work.
Jim Lucas ----- Original Message ----- From: "sundogcurt" <[EMAIL PROTECTED]> To: "GENERAL PHP LIST" <[EMAIL PROTECTED]> Sent: Monday, January 21, 2002 10:47 AM Subject: [PHP] ftp functions > <disclamer> > Before I get flamed for not reading the manual or trying on my own, I > would just like to say that I have been working on this for a few days > and have read the manual and looked at quite a few examples, all of > which seem to elude me. > </disclamer> > > I want to upload an image, and I want to use the ftp function to do so. > I want to use the ftp functions for two reasons, (1) I have not used > them yet, and (2) I will be loading an array with a list of files to be > uploaded and I think the ftp functions are better suited for this (as > opposed to the copy function). > > On to the trouble > > I can connect just fine. > > <? > $ftp_server = "xx.xx.xxx.xx"; > $ftp_user_name = "username"; > $ftp_user_pass = "password"; > > // set up basic connection > $conn_id = ftp_connect($ftp_server); > > // login with username and password > $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); > > // check connection > if ((!$conn_id) || (!$login_result)) { > echo "Ftp connection has failed!<br>"; > echo "Attempted to connect to $ftp_server for user > $ftp_user_name<br>"; > die; > } else { > echo "Connected to $ftp_server, for user $ftp_user_name<br>"; > } > > > //The file, even if I write the path out on my own, does not upload > eventually I will have the path put in from a form. > > > // upload the file > $destination_file = "/public_html/valeriemacwilliam/pics/$SID_.jpg"; > //(I have tried this without the beginning slash as well) > > $source_file = "C:\\temp\\prestigecars\\bk_jag.jpg"; > > $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); > > // check upload status > if (!$upload) { > echo "Ftp upload has failed!<br>"; > } else { > echo "Uploaded $source_file to $ftp_server as > $destination_file<br>"; > } > > //Even the ftp_close(function fails and causes an error); > // close the FTP stream > ftp_close($conn_id); > ?> > > Are the ftp functions depreciated? I have taken this example directly > from the manual and editted the values to reflect my own situation but > none of the function calls have been editted. Usually when this is the > case I have just over looked something VERY simple and easy, please take > a look and see what you can come up with. > > I would even be happy with an FAQ, I have been through the one on > PHP.NET with no joy \C: > > PHP is the lastest release running on Mandrake 8.1 (w / plenty of > horsepower) > > Thank you for your time. > ~Curt~ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]