Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: how to get the sizes of a file when i use CGI.PM to upload it~~?

by Wookie (Beadle)
on Jul 30, 2001 at 14:06 UTC ( [id://100829]=note: print w/replies, xml ) Need Help??


in reply to how to get the sizes of a file when i use CGI.PM to upload it~~?

Net::FTP can allow you to read the size of remote files pretty easily.

Below is some nice sample code for this I prepared earlier :)
#!/usr/bin/perl -w use strict; use Net::FTP; my ($server, $user, $pass, $file); my $ftph; my @files; my @list; $server = 'wookie.mcom.com'; $user = 'ukgaryc'; $pass = 'Radio105'; $ftph=Net::FTP->new($server)||die("No connection\n"); $ftph->login($user,$pass)||die("Can't login\n"); @files = $ftph->ls; foreach $file (@files) { my $size; $size = $ftph->size($file); $size ? print "$file is $size bytes\n" : print "Cannot get size of + file $file\n"; } $ftph->quit||die("Failed to disconnect\n"); exit(0);
Hope this helps :)
game(Wookie,opponent) eq 'Wookie' ? undef $problem : remove_limbs(arms,opponent);
  • Comment on Re: how to get the sizes of a file when i use CGI.PM to upload it~~?
  • Download Code

Replies are listed 'Best First'.
Re: Re: how to get the sizes of a file when i use CGI.PM to upload it~~?
by Beatnik (Parson) on Jul 30, 2001 at 16:17 UTC
    The idea is ofcourse to upload files from a browser to a HTTP server and not from an HTTP server to an FTP server, but ofcourse credits for mentioning Net::FTP :))

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://100829]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2025-03-18 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (56 votes). Check out past polls.