CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Upload Files To Other Servers

 



mariperl
Deleted

Oct 24, 2000, 10:47 PM

Post #1 of 9 (1270 views)
Upload Files To Other Servers Can't Post

I know I can upload files in perl to your own web server, I know I can read files from other servers, but can I read files from other servers using a perl script and thhen transfer them, using the upload and download speed of your own server, to another FTP (not my own server)....so if there's a file on xoom, can I write a perl script that uploads it to homestead, for example?


perlkid
stranger

Oct 26, 2000, 9:05 PM

Post #2 of 9 (1271 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

 
Hello, Not really, If anonamous login is allowed via ftp to the server then yes, But mostly it's not so then you couldn't.

Yet there is one alternative, xoom of course allows you to upload files to your storage using their form. If you automate the form submission, then you can do what you want, edit a file store it locally on your server, then transfer it to xoom's servers via cgi protocol. Instead of the traditional ftp (File Transfer Protocol). Do you see what I mean?

There are modules you can look into about automating form submissions, also perl.com will have information on it becuase it's a recipe stight from their book (Perl Cookbook), but I have never gotton into the modules for this, if you view the source of the page, and build a url by putting together all of the form field names, and the hidden values, then all you have to do is print location or print an iframe (An Iframe that's like 1 x 1 pixles) with the proper url, with the file location from your server, and it should work. With a little playing around with it I'm sure you could get it. If it's your first time. It could be a little difficult, and you may want to check into the modules if it suites you more.

perlkid

P.S. Forgive My Misspellings For Today, I'm in a hurry and pretty tired, thanks. Smile


mariperl
Deleted

Oct 27, 2000, 2:29 AM

Post #3 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

Tnx mate, I'll see if I can do this. If xoom doesn't work for me, then maybe another server.

mariperl.


mariperl
Deleted

Oct 29, 2000, 11:24 PM

Post #4 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

So, how can I actually download a file from the web to the server or download it into the memory. Does anyone have a code for it? Can you post it here? Thanks in advance.


sleuth
Enthusiast

Oct 30, 2000, 9:45 AM

Post #5 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

 
You can use LWP::Simple for that,

use LWP::Simple;
$file = get("http://location");

No it's in memory, if you want to write it to a file then just

open(file, ">file.db");
print file "$file";
close(file);

Sleuth


mariperl
Deleted

Nov 20, 2000, 6:46 AM

Post #6 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

Tnx man, I owe you! Works perfectly! Nice bitmap by the way, I like the matrix so I used it as my desktop background!


mariperl
Deleted

Nov 20, 2000, 10:01 AM

Post #7 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

I need your help again guys! I don't seem to get this script work for my binary files. Only files in ASCII mode are downloaded correctly. When I try a zip, a rar, jpg or a gif, they always seem to be corrupt. Is there a way to fix this problem? Should I use another source code? Please help me on this!


sleuth
Enthusiast

Nov 20, 2000, 10:38 AM

Post #8 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

 
Hi Again, Thanx for visiting :)

I testing this code out by downloading a zip file, and the logo on this site. The files were uncorrupted and a-ok.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


use LWP::Simple;
$file_name = "http://www.perldomain.com/matrix.zip";
$file = get("$file_name");
$file_name =~ m!^(.*)/(.*)!;
$name = $2;
open(file, ">$name");
binmode file;
print file $file;
close(file);
</pre><HR></BLOCKQUOTE>

That zip file is a matrix wallpaper I made too, it's sweet if your a matrix fan, your welcome to take it.

Sleuth


sleuth
Enthusiast

Nov 20, 2000, 11:51 AM

Post #9 of 9 (1270 views)
Re: Upload Files To Other Servers [In reply to] Can't Post

 
Thx, I have it on mine too, pass it around :)

Sleuth

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives