Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
P is for Practical
 
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 10:06 UTC ( [id://100829]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 12: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.