|
Hi
I have existing website which I have to update. This web uses a cgi mailer. when i try to send email through this page it gives server error. the cgi script is here:
I think that the first 15-20 lines is important.....
START SCRIPT:
#!/usr/bin/perl -wT
BEGIN { $DEBUGGING = 1; }
my $emulate_matts_code= 0;
my $secure = 1;
my $mailprog = '/bin/sendmail -oi -t';
my @referers = qw(fijiamcham.com mail.fijiamcham.com localhost);
my @allow_mail_to = qw(secretariat@fijiamcham.com);
my @recipients = ();
my @valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
my $date_fmt = '%A, %B %d, %Y at %H:%M:%S';
my $style = ''; # '/css/nms.css'; # include your site style sheet here
my $send_confirmation_mail = 0;
my $confirmation_text = <<'END_OF_CONFIRMATION';
From: you@your.com
Subject: form submission
Thankyou for your form submission.
END_OF_CONFIRMATION
#
# USER CONFIGURATION << END >>
# ----------------------------
# (no user serviceable parts beyond here)
# We don't need file uploads or very large POST requests.
# Annoying locution to shut up 'used only once' warning in older perl
$CGI::DISABLE_UPLOADS = $CGI::DISABLE_UPLOADS = 1;
$CGI::POST_MAX = $CGI::POST_MAX = 1000000;
# Merge @allow_mail_to and @recipients into a single list of regexps
push @recipients, map { /\@/ ? "^\Q$_\E\$" : "\@\Q$_\E\$" } @allow_mail_to;
# We need finer control over what gets to the browser and the CGI::Carp
# set_message() is not available everywhere
# This is basically the same as what CGI::Carp does inside but simplified
# for our purposes here.
BEGIN
{
sub fatalsToBrowser
{
my ( $message ) = @_;
if ( $main::DEBUGGING )
{
$message =~ s//>/g;
}
else
{
$message = '';
}
my ( $pack, $file, $line, $sub ) = caller(1);
my ($id ) = $file =~ m%([^/]+)$%;
return undef if $file =~ /^\(eval/;
print "Content-Type: text/html\n\n";
print <<eoerr;
<html>
<title>Error
Application Error
An error has occurred in the program
$message
EOERR
die @_;
};
$SIG{__DIE__} = \&fatalsToBrowser;
}
if ( $emulate_matts_code )
{
$secure = 0; # ;-}
}
my $debug_warnings = '';
# Empty the environment of potentially harmful variables
# This might cause problems if $mail_prog is a shell script
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
$ENV{PATH} = '/bin:/usr/bin';
my %valid_ENV;
@valid_ENV{@valid_ENV} = (1) x @valid_ENV;
# Uncomment the following line (and the Unit Tests section)
# to unit test URL checking functions
#
# unitTest();
my $style_element = $style ?
qq%%
: '';
check_url();
my $date = strftime($date_fmt, localtime);
my (%Config, %Form);
my @Field_Order = parse_form();
check_required();
send_mail();
return_html();
sub check_url {
my $check_referer = check_referer(referer());
error('bad_referer') unless $check_referer;
}
sub check_referer
{
my $check_referer;
my ($referer) = @_;
if ($referer && ($referer =~ m!^https?://([^/]*\@)?([^/]+)!i)) {
my $refHost;
if (defined($1) and (! $secure)) {
$refHost = $1;
chop $refHost;
} else {
$refHost = $2;
}
foreach my $test_ref (@referers) {
if ($refHost =~ m|\Q$test_ref\E$|i) {
$check_referer = 1;
last;
}
elsif ( $secure && $test_ref =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ ) {
if ( my $ref_host = inet_aton($refHost) ) {
$ref_host = unpack "l", $ref_host;
if ( my $test_ref_ip = inet_aton($test_ref) ) {
$test_ref_ip = unpack "l", $test_ref_ip;
if ( $test_ref_ip == $ref_host ) {
$check_referer = 1;
last;
}
}
}
}
}
} else {
$check_referer = $secure ? 0 : 1;
}
return $check_referer;
};
sub parse_form {
my @fields = qw(
recipient
subject
email
realname
redirect
bgcolor
background
link_color
vlink_color
text_color
alink_color
title
sort
print_config
required
env_report
return_link_title
return_link_url
print_blank_fields
missing_fields_redirect
);
@Config{@fields} = (undef) x @fields; # make it undef rather than empty string
my @field_order;
foreach (param()) {
if (exists $Config{$_}) {
my $val = strip_nonprintable(param($_));
next if /redirect$/ and not check_url_valid($val);
$Config{$_} = $val;
} else {
my @vals = map {strip_nonprintable($_)} param($_);
my $key = strip_nonprintable($_);
$Form{$key} = @vals == 1 ? $vals[0] : [@vals];
push @field_order, $key;
}
}
foreach (qw(required env_report print_config)) {
if ($Config{$_}) {
$Config{$_} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{$_} =~ s/(\s+)?\n+(\s+)?//g;
$Config{$_} = [split(/,/, $Config{$_})];
} else {
$Config{$_} = [];
}
}
$Config{env_report} = [ grep { $valid_ENV{$_} } @{$Config{env_report}} ];
return @field_order;
}
sub check_required {
my ($require, @error);
defined $Config{subject} or $Config{subject} = '';
defined $Config{recipient} or $Config{recipient} = '';
if ($Config{subject} =~ /[\n\r]/m ||
$Config{recipient} =~ /[\n\r]/m) {
error('no_recipient');
}
if ($Config{recipient}) {
my @valid;
foreach (split /,/, $Config{recipient}) {
next unless check_email($_);
if (check_recipient($_)) {
push @valid, $_;
}
}
error('no_recipient') unless scalar @valid;
$Config{recipient} = join ',', @valid;
} else {
my @allow = grep {/\@/} @allow_mail_to;
if (scalar @allow > 0 and not $emulate_matts_code) {
$Config{recipient} = $allow[0];
} elsif (%Form) {
error('no_recipient')
} else {
error('bad_referer')
}
}
if ($secure and request_method() ne 'POST') {
error('bad_method');
}
foreach (@{$Config{required}}) {
if ($_ eq 'email' && !check_email($Config{$_})) {
push(@error, $_);
} elsif (defined($Config{$_})) {
push(@error, $_) unless $Config{$_};
} else {
push(@error,$_) unless $Form{$_};
}
}
error('missing_fields', @error) if @error;
}
sub check_recipient {
my ($recip) = @_;
foreach my $r (@recipients) {
if ( ($recip =~ /(?:$r)$/) or $emulate_matts_code and ($recip =~ /$r/i) ) {
return(1);
}
}
warn_bad_email($recip, "script not configured to allow this address");
return(0);
}
sub return_html {
my ($key, $sort_order, $sorted_field);
if ($Config{'redirect'}) {
print redirect $Config{'redirect'};
} else {
print header;
my $title = escape_html( $Config{'title'} || 'Thank You' );
my $recipient = escape_html($Config{'recipient'});
my $attr = body_attributes(); # surely this should be done with CSS
print <<eohtml;
<html>
<title>$title
$style_element
h1.title {
text-align : center;
}
$debug_warnings
$title
Below is what you submitted to $recipient on $date
EOHTML
my @sorted_fields;
if ($Config{'sort'}) {
if ($Config{'sort'} eq 'alphabetic') {
@sorted_fields = sort keys %Form;
} elsif ($Config{'sort'} =~ /^order:.*,.*/) {
$sort_order = $Config{'sort'};
$sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$sort_order =~ s/(\s+)?\n+(\s+)?//g;
$sort_order =~ s/order://;
@sorted_fields = split(/,/, $sort_order);
} else {
@sorted_fields = @Field_Order;
}
} else {
@sorted_fields = @Field_Order;
}
foreach (@sorted_fields) {
if ($Config{print_blank_fields} || $Form{$_}) {
print '', escape_html($_), ': ',
escape_html($Form{$_}), " \n";
}
}
print qq{ \n};
if ($Config{return_link_url} && $Config{return_link_title}) {
print "\n";
}
print <<end_html_footer;
<hr="" size="1" width="75%">
FormMail
© 2001 London Perl Mongers
END_HTML_FOOTER
}
}
sub send_mail {
my $dashes = '-' x 75;
my $realname = $Config{realname};
if (defined $realname) {
if ($secure) {
# A transform to eliminate some potential problem characters
$realname =~ tr#()\\#{}/#;
$realname =~ s#\s+# #g;
}
$realname = " ($realname)";
} else {
$realname = $Config{realname} = '';
}
my $subject = $Config{subject} || 'WWW Form Submission';
my $email = $Config{email};
unless (defined $email and check_email($email)) {
$email = 'nobody';
}
if ("$Config{recipient}$email$realname$subject" =~ /\r|\n/) {
die 'multiline variable in mail header, unsafe to continue';
}
my $xheader = '';
if ( $secure and defined (my $addr = remote_addr()) ) {
$addr =~ /^([\d\.]+)$/ or die "bad remote addr [$addr]";
$xheader = "X-HTTP-Client: [$1]\n";
}
if ( $send_confirmation_mail ) {
open(CMAIL,"|$mailprog")
|| die "Can't open $mailprog\n";
print CMAIL $xheader, "To: $email$realname\n$confirmation_text";
close CMAIL;
}
open(MAIL,"|$mailprog")
|| die "Can't open $mailprog\n";
print MAIL $xheader, <<eomail;
to: $config{recipient}
from:="" $email$realname
subject:="" $subject
below="" is="" the="" result="" of="" your="" feedback="" form.="" it="" was="" submitted="" by
$config{realname}="" (${\(="" $config{email}||''="" )})="" on="" $date
$dashes
eomail
="" if="" ($config{print_config})="" {
="" foreach="" (@{$config{print_config}})="" print="" mail="" "$_:="" $config{$_}\n\n"="" $config{$_};
="" }
="" }
="" my="" @sorted_keys;
="" ($config{'sort'})="" ($config{'sort'}="" eq="" 'alphabetic')="" @sorted_keys="sort" keys="" %form;
="" }="" elsif="" ^order:.*,.*="" )="" $config{'sort'}="~" s="" (\s+|\n)?,(\s+|\n)?="" ,="" g;
="" (\s+)?\n+(\s+)?="" order:="" ;
="" $config{'sort'});
="" else="" (@sorted_keys)="" ($config{'print_blank_fields'}="" ||="" defined="" $form{$_})="" ",="" (ref="" $form{$_}="" ?="" "@{$form{$_}}"="" :="" $form{$_}),"\n\n";
="" "$dashes\n\n";
="" (@{$config{env_report}})="" $env{$_}\n"="" $env{$_};
="" close="" (mail)="" die="" $!;
}
sub="" check_email="" ($email)="@_;
" return="" 0="" $email="~" ^\s*$="" ;
="" unless="" ($email="~" ^(.+)\@([a-z0-9_\.\-\[\]]+)$="" is)="" warn_bad_email($email,="" "malformed="" email="" address");
="" 0;
="" ($user,="" $host)="($1," $2);
="" ($host="~" \.\.="" "hostname="" $host="" contains="" '..'");
="" ^\.="" starts="" with="" '.'");
="" \.$="" ends="" ($emulate_matts_code="" and="" not="" $secure)="" #="" be="" as="" generous="" possible="" without="" opening="" any="" known="" or="" strongly
="" suspected="" relaying="" holes.
="" ($user="~" ([^a-z0-9_\-\.\#\$\&\'\*\+\="" \="\?\^\`\{\|\}\~\200-\377])/i)" $c="sprintf" '%s="" (ascii="" 0x%.2x)',="" $1,="" unpack('c',$1);
="" "bad="" character="" $c");
="" 1;
="" only="" allow="" reasonable="" addresses.
="" ([^a-z0-9_\-\.\*\+\="])/i)" (length="" $user=""> 100) {
warn_bad_email($email, "username part too long");
return 0;
}
if (length $host > 100) {
warn_bad_email($email, "hostname too long");
return 0;
}
return 1 if $host =~ /^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
return 1 if $host =~ /^[a-z0-9\-\.]+$/i;
warn_bad_email($email, "invalid hostname $host");
return 0;
}
# not reached
return 0;
}
sub warn_bad_email {
my ($email, $whybad) = @_;
$debug_warnings .= <<end if="" $debugging;
<p="">
Warning:
The email address ${\( escape_html($email) )} was rejected
for the following reason: ${\( escape_html($whybad) )}
END
}
# check the validity of a URL.
sub check_url_valid {
my $url = shift;
# allow relative URLs with sane values
return 1 if $url =~ m#^[a-z0-9_\-\.\,\+\/]+$#i;
$url =~ m< ^ (?:ftp|http|https):// [\w\-\.]+ (?:\:\d+)?
(?: / [\w\-.!~*'(|);/?\@&=+\$,%#]* )?
$
>x ? 1 : 0;
}
sub strip_nonprintable {
my $text = shift;
$text=~ tr#\011\012\040-\176\200-\377##dc;
return $text;
}
sub body_attributes {
my %attrs = (bgcolor => 'bgcolor',
background => 'background',
link_color => 'link',
vlink_color => 'vlink',
alink_color => 'alink',
text_color => 'text');
my $attr = '';
foreach (keys %attrs) {
next unless $Config{$_};
if (/color$/) {
next unless $Config{$_} =~ /^(?:#[0-9a-z]{6}|[\w\-]{2,50})$/i;
} elsif ($_ eq 'background') {
next unless check_url_valid($Config{$_});
} else {
die "no check defined for body attribute [$_]";
}
$attr .= qq( $attrs{$_}=") . escape_html($Config{$_}) . '"' if $Config{$_};
}
return $attr;
}
sub error {
my ($error, @error_fields) = @_;
my ($host, $missing_field, $missing_field_list);
my ($title, $heading,$error_body);
if ($error eq 'bad_referer') {
my $referer = referer();
$referer = '' if ! defined( $referer );
my $escaped_referer = escape_html($referer);
if ( $referer =~ m|^https?://([\w\.]+)|i) {
$host = $1;
$title = 'Bad Referrer - Access Denied';
$heading = $title;
$error_body =<<eobody;
<p>
The form attempting to use FormMail resides at $escaped_referer,
which is not allowed to access this program.
If you are attempting to configure FormMail to run with this form,
you need to add the following to \@referers, explained in detail in the
README file.
Add '$host' to your \@referers array.
EOBODY
}
else {
$title = 'Formail';
$heading = $title;
$error_body = 'Badness! ';
}
}
elsif ($error eq 'bad_method') {
my $ref = referer();
if (defined $ref and $ref =~ m#^https?://#) {
$ref = 'at ' . escape_html($ref) . '';
} else {
$ref = 'that you just filled in';
}
$title = 'Error: GET request';
$heading = $title;
$error_body =<<eobody;
<p>
The form $ref fails to specify the POST method, so it would not
be correct for this script to take any action in response to
your request.
If you are attempting to configure this form to run with FormMail,
you need to set the request method to POST in the opening form tag,
like this:
<form action="/cgi-bin/FormMail.pl" method="POST">
EOBODY
} elsif ($error eq 'no_recipient') {
my $recipient = escape_html($Config{recipient});
$title = 'Error: Bad or Missing Recipient';
$heading = $title;
$error_body =<<eobody;
<p>
There was no recipient or an invalid recipient specified in the
data sent to FormMail. Please make sure you have filled in the
recipient form field with an e-mail address that has
been configured in \@recipients. More information on
filling in recipient form fields and variables can be
found in the README file.
The recipient was: [ $recipient ]
EOBODY
}
elsif ( $error eq 'missing_fields' ) {
if ( $Config{'missing_fields_redirect'} ) {
print redirect($Config{'missing_fields_redirect'});
exit;
}
else {
my $missing_field_list = join '',
map { '' . escape_html($_) . "\n" }
@error_fields;
$title = 'Error: Blank Fields';
$heading = $title;
$error_body =<<eobody;
<p>
The following fields were left blank in your submission form:
These fields must be filled in before you can successfully
submit the form.
Please use your back button to return to the form and
try again.
EOBODY
}
}
print header();
print <<end_error_html;
<!doctype html="" public="" "-="" w3c="" dtd="" xhtml="" 1.0="" transitional="" en"
="" "http:="" www.w3.org="" tr="" xhtml1="" xhtml1-transitional.dtd"="">
<title>$title
$style_element
$debug_warnings
$error_body
FormMail
© 2001 London Perl Mongers
|
END_ERROR_HTML
exit;
}
use vars qw(%escape_html_map);
BEGIN
{
%escape_html_map = ( '&' => '&',
'<' => '<',
'>' => '>',
'"' => '"',
"'" => ''',
);
}
sub escape_html {
my $str = shift;
my $chars = join '', keys %escape_html_map;
if (defined($str))
{
$str =~ s/([\Q$chars\E])/$escape_html_map{$1}/g;
}
return $str;
}
# begin Unit Tests
# sub unitTest
# {
# recipientTests();
# refererTests();
# exit(0);
# }
# #
# sub recipientTests()
# {
# recipCheck('you@your.domain', 1, 1);
# recipCheck('you@your.domain', 1, 0);
# recipCheck('some.one.else@your.domain', 1, 1);
# recipCheck('some.one.else@your.domain', 1, 0);
# recipCheck('anyone@localhost', 1, 1);
# recipCheck('anyone@localhost', 1, 0);
# recipCheck('localhost', 0, 1);
# recipCheck('localhost', 0, 0);
# recipCheck('user%elsewhere.com@localhost', 0, 1);
# recipCheck('user%elsewhere.com@localhost', 0, 0);
# #
# recipCheck('YOU@your.domain', 1, 1);
# recipCheck('YOU@your.domain', 0, 0);
# recipCheck('some.one.else@YOUR.domain', 1, 1);
# recipCheck('some.one.else@YOUR.domain', 0, 0);
# recipCheck('anyone@Localhost', 1, 1);
# recipCheck('anyone@Localhost', 0, 0);
# #
# recipCheck('<user@elsewhere.com>your.domain', 0, 0);
# recipCheck('user@elsewhere.com(your.domain', 0, 0);
# }
# #
# sub recipCheck
# {
# my ($recip, $shouldBeGood, $emulate) = @_;
# my $secureMsg;
# #
# $emulate = 0 if ! defined( $emulate );
# #
# if ($emulate)
# {
# $secure = 0;
# $emulate_matts_code = 1;
# $secureMsg = 'insecure';
# }
# else
# {
# $secure = 1;
# $emulate_matts_code = 0;
# $secureMsg = 'secure';
# }
# #
# if ($shouldBeGood)
# {
# if ((! check_email($recip)) or (! check_recipient($recip)))
# {
# warn "$recip should be good ($secureMsg)";
# }
# }
# else
# {
# if (check_email($recip) and check_recipient($recip))
# {
# warn "$recip should be bad ($secureMsg)";
# }
# }
# }
# #
# sub refererTests
# {
# refCheck('xxx.xxx.xxx', 0);
# refCheck('http://dave.org.uk', 1);
# refCheck('http://dave.org.uk/', 1);
# refCheck('http://dave.org.uk/more', 1);
# refCheck('https://dave.org.uk/', 1);
# refCheck(undef, 0, 0);
# refCheck(undef, 1, 1);
# refCheck('https://dave.org.uk@someplace.else.com', 0);
# refCheck('https://dave.org.uk@someplace.else.com', 1, 1);
# refCheck('https://someguy@dave.org.uk', 0, 1);
# refCheck('https://someguy@dave.org.uk', 1, 0);
# refCheck('https://someguy@dave.org.uk/more', 1, 0);
# refCheck('http://209.207.222.64', 1);
# refCheck('http://localhost/', 1);
# }
# #
# sub refCheck
# {
# my ($referer, $shouldBeGood, $emulate) = @_;
# my $secureMsg;
# #
# $emulate = 0 if ! defined( $emulate );
# #
# if ($emulate)
# {
# $secure = 0;
# $secureMsg = 'insecure';
# }
# else
# {
# $secure = 1;
# $secureMsg = 'secure';
# }
# #
# if ($shouldBeGood)
# {
# warn "$referer should be good ($secureMsg)" if ! check_referer($referer);
# }
# else
# {
# warn "$referer should be bad ($secureMsg)" if check_referer($referer);
# }
# }
END SCRIPT.
Deepak Anish
Computer Programmer
Maxumise Fiji Ltd
Suva, Fiji
|
|
|
|
|
|
ITs giving 500 server error...
Deepak Anish
Computer Programmer
Maxumise Fiji Ltd
Suva, Fiji
|
|
|
|
|
Hi, here is my question, any help will be greatly appreciated.
You know how in firefox, when you click on page info and you go to the links section and can view a list of all the links in the current web page. How could I extract all the links from a web page into a list using IWebBrowser2, IHtmlDocument, etc. in C++?
Please help, thanks.
|
|
|
|
|
|
Hi,
Actually in my project i have to ask user to enter data in text field and then show that data in textArea box.
so my problem is a facility to edit that data and remove selected data from textbox once entered...
my question is how can i edit/remove only selected data.
Sushant Mathur
Bangalore,
INDIA.
http://n.domaindlx.com/fun2ssh/HOME.htm
-- modified at 10:16 Wednesday 1st March, 2006
|
|
|
|
|
so you want a user to type some string into a TextBox, then remove all occurrances of that string from the TextArea?
nicko
|
|
|
|
|
|
Hi,
How to implement transactions in Biz logic layer in 3 tier arch.
in asp.net with vb.net or C#.net
pls help on this,
thanks and regards,
Ravi
vaswani_ravi@rediffmail.com
|
|
|
|
|
So.... what's the question?
|
|
|
|
|
Did not got your question brother
|
|
|
|
|
Hi all,
do you know any Javascript or PHP snippet to let the users from a content manager site sort a list of images? what I'd like to do is to put all the images on the page and then let the user sort them. One way could be adding a typical list box with all the image names but I 'd like something more graphic.
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
|
But this is an automatic sort. I'm looking for a user sort. I mean, for example, the typical way to do that is to insert a list box with all the pictures names and an up&down arrow to permit the sort. This is an option but I'm looking for something fmore graphical like a drag&drop imgage sort.
Thanks for your help,
Marc
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Hi
I have two forms in single asp page, how can i access these forms from asp
Ex
<html>
<body>
<form id="Form1" method="post" runat="server">
<input type=text name=cCode>
</form>
<form id="Form2" method="post" runat="server">
<input type=text name=cName>
</form>
</body>
</html>
How can i get cCode & cName from this.
Thanks in advance
Panal
|
|
|
|
|
|
I'm getting some wierd characters in the returned ResponseText string of my xmlhttp object basically any characters such as
è à, etc are being returned as either japanese kanji in the arial unicode MS font or the undefined
� now i need to know if there is a way to force the http request to return the original characters that are being changed.
if anyone needs some more information just drop a response and i'll post more just have a bit of a headache on this one so i'm making it brief
thanks for the help
Ryan
|
|
|
|
|
|
Thanks for the help i'm going to try that when i get to the office.
on a side note when i originally posted this question i was using the old Microsft.XMLHttp object to query google's driving directions search which was working fine with the exception of the aforementioned weird characters now when i tried to use the newer Msxml2.XMLHTTP object instead to see if maybe it was a compatability issue all i got back from google was
"Google does not support directions on its html interface. If your browser supports JavaScript, enable it, and then click here.
You can also try searching for your directions on MapQuest."
So in a nutshell that's what i did and the Msxml2.XMLHTTP worked like a charm and with a little bit of a bonus the html tags from the mapquest httprequest are removed with a fairly simple regex (with google maps there's a ton of their own extra stuff in there - almost a 20+ page text file)
so just to let anyone out there who happens by know that apparently google only supports the outdate Microsoft.XMLHttp object
Ryan
|
|
|
|
|
TofuBug24 wrote: so just to let anyone out there who happens by know that apparently google only supports the outdate Microsoft.XMLHttp object
I suspect there's a difference between the two in the headers sent by default. Google is likely interpreting certain headers as indication that the requesting app supports / does not support javascript.
----
Bots don't know when people die.
--Paul Watson, RIP
|
|
|
|
|
I am using the following code to force download files from a Classic ASP webpage:
<br />
<%@ Language=VBScript %><br />
<%Response.buffer = True<br />
filePath = request("fpath")<br />
fileName = request("fname")<br />
'Response.Write(Server.MapPath(filePath & "/" & filename))<br />
'Response.End<br />
Response.ContentType = "application/asp-unknown"<br />
Response.AddHeader "content-disposition","attachment; filename=" & fileName<br />
Set FStream = Server.CreateObject("ADODB.Stream")<br />
FStream.Open()<br />
FStream.Type = 1<br />
FStream.LoadFromFile(Server.MapPath(filePath & "/" & filename))<br />
Response.Clear<br />
Response.BinaryWrite FStream.Read()<br />
Response.Flush<br />
Response.End<br />
FStream.Close<br />
Set FStream = Nothing<br />
%>
Everything works fine except that when it tries to download a file size over 5 MB I get an error. Can someone tell me, how to not restrict the file size, or set the file size really high. Thanks.
-- modified at 16:53 Tuesday 28th February, 2006
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
It tells that "Internet Explorer cannot download movie1.mpg from mydomain.com.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
I checked the server that holds the file and the file is there.
|
|
|
|
|
Disable the "Show friendly http error messages" setting in the advanced internet options, so that you see the real error message that the server sends.
---
b { font-weight: normal; }
|
|
|
|
|
The "Show friendly Http error messages" setting is off. Also when I click on the link for downloading, the File Download Dialog box starts to open and then a message box pops up with the message from before.
|
|
|
|
|