the copy() function is subject to the same problem that the ftp functions are. you are trying to call a function that is on the remote server and you want it to do things to the local machine. unfortunatly you cannot do this. through a web browser you have no direct access to the local client machine.
Jim ----- Original Message ----- From: "sundogcurt" <[EMAIL PROTECTED]> To: "GENERAL PHP LIST" <[EMAIL PROTECTED]> Sent: Monday, January 21, 2002 11:34 AM Subject: Re: [PHP] ftp functions > Would you suggest that I use the copy function instead? > I have tried the copy function in a prelim test and I had trouble with > the function "finding" the file on the local machine. From what I have > seen in the FAQs on PHPBUILDER and this is not an uncommon problem. > > One possible solution was that the path to the file to be uploaded must > be relative to the location of the script. This doesn't make much sense > to me though seeing as the file to be uploaded is on the local machine > and the script on the remote machine. > > I'm drowning here, anybody have a rope? > > > [EMAIL PROTECTED] wrote: > > >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]