in reply to Re^3: CRC Error on ZIP Files
in thread CRC Error on ZIP Files
sorry for answering late ! Yes, sure, below you find the complete script.
It gets called with two parameters, the path and the name of the file to be downloaded
I left all the commented sections inside, they result from different approaches
to the function or they were meant to provide information
of what the script was receiving and doing with it.
Having downloaded the file, the source directory gets removed.
Finally the script calls a defined URL to return to
Thanks for your efforts !
Cheers
Uli
#!/usr/bin/perl #use warnings; # open (datei, "<liste.txt"); # $verzeichnis=<datei>; # close datei; $Datten = $ENV{'QUERY_STRING'}; @Daten=split(/&/, $Datten); @dateien=split(/=/, @Daten[0]); @verz=split(/=/, @Daten[1]); $verzeichnis = @verz[1]; # print "Content-type: text/html\n\n"; # # print $Datten."<br>\n"; # print @Daten."<br>\n"; # print @dateien."<br>\n"; # print @verz."<br>\n"; # print $verzeichnis."<br>\n"; # print @dateien[1]."<br>\n"; # exit; download($verzeichnis, @dateien[1]); # $url = $verzeichnis.@dateien[1]; # print "Location: $url\n\n"; wait(); use File::Path qw( rmtree ); rmtree( $verzeichnis ); # Verzeichnisse in downloads, ‰lter as 1 Tag lˆschen # opendir(zeig,'../downloads/./'); # @entries = readdir(zeig); # close zeig; opendir zeig, '../downloads/./'; while ($entry = readdir zeig){ push (@entries, $entry); } #$index=-1; open (file, ">", "aktion.txt"); print file @entries; foreach $entry (@entries) { #$index++; print file $entry."\n"; if ($entry ne '.' && $entry ne '..' && $entry ne "index.html") { if(-d "../downloads/$entry") { if ((-M "../downloads/$entry") >1 ) { rmtree( "../downloads/$entry" ); print file " wurde gelöscht\n"; } } } } close (file); open (datei,">","fertig.txt"); print datei "Nachhause.pl !"; close datei; # $status=""; # $status=system("../cgi-bin/nachhause.pl","../donwloads/index.html"); # # wiederwarten: # unless ($status ne "") { # goto wiederwarten; # } heimat(); exit; sub download { use CGI; $html=new CGI; #print $html->header(-type => 'application/octet-stream', -attachment +=> $_[1]); print $html->header(-type => 'application/zip', -attachment => $_[1]); + open($peunter, "<", $_[0].$_[1]); binmode($peunter); binmode STDOUT; while (read($peunter,$bytes,1024)) { unless (eof()) { #unless (length($bytes)<1024) { chomp($bytes); } print $bytes; } #@data = <$peunter>; close($peunter); #print "@data"; } sub heimat { # use CGI; # # $htm=new CGI; # print $htm->header(-type =>'text/html', -expires => 'now'); # print $htm->system("../cgi-bin/nachhause.pl","../donwloads/index.htm +l"); $- =0; system("../cgi-bin/nachhause.pl","../donwloads/index.html"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: CRC Error on ZIP Files
by hazylife (Monk) on Mar 11, 2014 at 21:14 UTC | |
by SearchigPerl (Acolyte) on Mar 11, 2014 at 22:59 UTC | |
by hazylife (Monk) on Mar 12, 2014 at 16:36 UTC | |
by SearchigPerl (Acolyte) on Mar 13, 2014 at 21:33 UTC | |
by SearchigPerl (Acolyte) on Mar 27, 2014 at 16:05 UTC | |
|