develooper Front page | perl.beginners | Postings from February 2002

Script to Download a file from server to a C:/D:

From:
Kayren Phillips
Date:
February 5, 2002 13:03
Subject:
Script to Download a file from server to a C:/D:
Message ID:
3C60468B.28A59DA5@head-cfa.harvard.edu
Hello There!!

I am trying to write a script that will download any file that has been
requested from my server to anywhere on the requestor's local hard drive
(C: /D: /F: etc.). I have been working on this script for two weeks now,
not much success. Can someone help point me in the correct direction?
i.e. am I even using the right process? Should I be looking at I/O or
SOCKET modules? This script keeps dying when I specify a local hard
drive, says it can't open it!  Thanks for all help given :)K


> #!/usr/bin/perl -w
>
> use CGI;
>
> #$download_dir = "/usr/home/MAR01/justforkicks1/public_html/upload/download_test.html";
> $download_dir = "/proj/xrtwww/httpd/htdocs/dev/scrapbook/download_test.txt";
> $query = new CGI;
>
> $filename = $query->param("photo");
>
> $email_address =  $query->param("email_address");
> #$filename =~ s/.*[\/\\](.*)/$1/
> #$download_filehandle =  $query->download("photo");
>
> open (DOWNLOADFILE, "$download_dir") || die "can not open this";
> open (DDD, ">$filename") ||  die "will not open this";
> binmode(DOWNLOADFILE);
> binmode(DDD);
> while ()
> {
> print DDD;
> }
>
> close DOWNLOADFILE;
> close DDD;
> #print  $query->header ();
> print <HTML>
>
>
>
>
>
>
> Thanks for uploading your photo!
>
> your email address: $email_address
>
> Your photo
> << END_HTML



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About