|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Net::FTP and 'one click' file transfer
I have been trying to understand the Net::FTP module with regard to a particular system I am trying to put into place.
I would like to be able to transfer a file from my server to another server by clicking a send button or link in my browser. Thus the server information (username, password etc) to where I am sending would be kept in a file or database on my server and the send button would create a connection between the servers, transfer the file and then disconnect. However Net::FTP seems to require a command line input which would impair the desired 'one click' transfer I am looking for. Is it possible to create a system like the one I describe using Net::FTP or other module, or am I flogging a dead horse? |
|
#2
|
|||
|
|||
|
So you've got 2 servers (server A and server B). Server A contains a file that should be sent to server B.
This transfer should start when you click the button in your browser. The script that sends the file from A to B resides on server A. I don't see a real problem here. If you store all the required information (hostname,user,password,sourcefile, targetfile) on server A, the script on server A could connect to server B and send the file, as soon as you click the button in your browser. The command line input is just the commands that are needed to transfer the file from A to B, something like Quote:
/edit BTW: Check this site for more Net:FTP options: http://www.perldoc.com/perl5.8.0/lib/Net/FTP.html |
|
#3
|
|||
|
|||
|
Thanks d0g1e for replying - you have given me the confidence to keep trying!
Assimilating all the info I have read I have the following assuptions and a script (these may be way off base but I feel I am getting close(r)!) Remember my script is on ServerA and I am moving a file from Server A (serva) to Server B (servb). My assumption is that I have to call up and get the script from serva and then operate a sub routine to put the file on servb. So far I am trying to get the file but I am getting the error message: 'couldn't change directory' (die message line 11). I wonder if anyone could check it and see if I have a problem there, or any other reason why the directory might not change? PHP Code:
|
|
#4
|
|||
|
|||
|
The code looks fine.. (I can't try it at the moment)
Have you tried executing those commands by hand (using a ftp client?) How about adding a trailing / (slash) to the directory |
|
#5
|
|||
|
|||
|
Thanks once again for getting back to me.
I have just resolved the issue: $directory="/home/users/serva/public_html"; did not require a path - I altered the line to: $directory="public_html"; and the script moved on to die at 'Couldn'tÊgetÊfaq.htm' I checked: $filename="faq.htm"; and found it to be "faq.html". I corrected it and the script went straight to Error 500. I assume that there's no problem with any of the steps so far but I need to go ahead and finish it! |
|
#6
|
|||
|
|||
|
Strange.. absolute paths are supposed to work with ftp. Did the user have insufficient permissions?
anyway, add some http headers and you should be done! (I guess) have fun ![]() |
|
#7
|
|||
|
|||
|
Well, after a certain amount of fiddling around I got the script transferring server to server - I really appreciate your help. In the end it was straightforward but more of a confidence thing so you support was really useful.
As a postscript I tried using the /path/ of servb for the upload and that was not accepted either - a simple directory name was all that was required (both sites are operated by the same ISP - though on different servers). I may pose the question to the ISP if I get the time. Thanks once again. |
|
#8
|
|||
|
|||
|
No problem
![]() |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > Net::FTP and 'one click' file transfer |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|