Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-08-2012, 11:11 PM   PM User | #1
Philosophaie
New Coder

 
Join Date: Sep 2010
Posts: 46
Thanks: 1
Thanked 1 Time in 1 Post
Philosophaie is an unknown quantity at this point
ftp download

I am trying to upload a file to the user activating this link. This is missing a key element like an fputs or something?

PHP Code:
function planetaryorbits(){
        
$source "/home/rubeum/public_html/PlanetaryOrbits.xlsm";
        
$target fopen("/home/rubeum/public_html/PlanetaryOrbits.xlsm""w");
        
$conn = @ftp_connect("ftp.webserver.com") or die("Could not connect");
        
ftp_login($conn,"user","pass") or die("Could not login");
        
ftp_fget($conn,$target,$source,FTP_ASCII);
        
ftp_close($conn);
    } 
Philosophaie is offline   Reply With Quote
Old 06-08-2012, 11:38 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Upload or download? You describe upload, but this one here downloads. To upload you'd use ftp_[f]put instead. It is also possible that the file as you are looking for with the path is invalid, so you'll need to check if that exists with ftp_nlist or ftp_rawlist and navigating as necessary. Actually, now that I think of it I'm not sure if you can command an ftp server to give you a file with a filepath; it may only be happy with a file name based on the pwd. And I can't test that right now either.

The "user" in this scope would be that of the connection to ftp.webserver.com of course; you can't force an ftp connection to a client, although if they have ftp services enabled you can connect to them if you pull their ip from remote host (and if its accurate) and transfer a file that way too. That would be sandboxed into the environment that they have supplied as a valid location. I would deem that as an unreliable option, for which you should prompt them with a save dialog and serve it over http instead.
Fou-Lu is offline   Reply With Quote
Old 06-09-2012, 12:03 AM   PM User | #3
Philosophaie
New Coder

 
Join Date: Sep 2010
Posts: 46
Thanks: 1
Thanked 1 Time in 1 Post
Philosophaie is an unknown quantity at this point
A link from the website downloads a file using ftp from my server.

Both paths ($source and $target) are from the root directory of my server.

These my be incorrect.
Philosophaie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:42 PM.


Advertisement
Log in to turn off these ads.