Dear Friends:
Thanks for taking patience in answering the question. I have the issue resolved like this but I am not sure how it works. Here is the code
my $subject="Monthly Report";
my $file_link="\n Dear Customer: Please click on the link below to dow
+nload the Monthly Report for the month of 2019-05. <br><br> <a href=\
+"https://$hostname/ui_report/download_report?file=$fileloc\">Download
+ Report</a></center> \n\n"; # $fileloc contains the path of the store
+d file in our server.
&SendEmail($from,$toAddress,$cc,$bcc,$subject,'text/html',$file_link,$
+from); # This module sends an email with link - by clicking will down
+load the excel report.
In the "download_report" script:
if ($file =~ /\.xlsx$/) {
print "Content-type: application/vnd.openxmlformats-officedocument.spr
+eadsheetml.sheet\n";
# The Content-Disposition will generate a prompt to save the file.
print "Content-Disposition: attachment; filename=$file\n";
print "\n";
&download ($fileloc);
exit 0; # NEWLY ADDED DUE TO ISSUE IN EXCEL REPORT OPENING
}
print "Content-Type: text/html\r\n\r\n";
my $cgi = new CGI;
print $cgi->redirect("tent");
print "The redirect seems to have failed.";
die;
By simply adding "exit 0; " statement I am able to download and view the report without any warnings. I believe previously after the execution of if block, it continued the execution and it might have created the problem.
Please let me know if my explanation is not sufficient.
Above
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|