file does not begin with '%PDF-' - Error when searching pdfs on FireFox browser

L

lvb

Hello all:

I have monthly PDFs that I store in a directory and display the 2
latest ones, the rest user can search them by date (mm-yyyy). Now I
have 2 questions:

First, which one is a better solution, store in a directory or in a
database and retrieve? It just started so we only have a few PDFs now.
What happens if latter we add more and more PDFs?

Second, and it's the problem, the PDFs are just fine, I can open them
directly on any browser. However when I search & open it, it throws an
error " file does not begin with '%PDF-' " on Firefox and on some IE
browser (my laptop's IE gives the same error.). I've done some
research, Adobe gives solution
http://www.adobe.com/support/techdocs/319294.html
But it doesn't satisfy me. Does anyone know what happens here? Could
it be my script's problem? Please see the script below:

if (defined $ins{newsletter_text}) {

my $letter = "$ins{newsletter_text}.pdf";

$path_dir = "/www/html/newsletter/";
opendir(DIRhandle, $path_dir) || die("Cannot open directory");
@thefiles= readdir(DIRhandle);
closedir(DIRhandle);

foreach $file (sort @thefiles) {

unless ( ($file eq ".") || ($file eq "..") ) {
if ($file eq $ins{newsletter_text}) {
print "location:/newsletter/$ins{newsletter_text}\n\n";
last;
}
elsif ($file =~ /\Q$ins{newsletter_text}\E/i) {
if ($ins{newsletter_text} =~ m/^\d\d-\d\d\d\d$/) {
print "location:/newsletter/$letter\n\n";
} else {
print "location:/cgi-bin/outdoor.cgi?pg=gov&err=1\n\n";
}
}
}
}

Also I realized that when I open the PDF from a link, in the Address
Bar, it shows the path something like '/gl/newsletter/06-2006.pdf'
but when I open it from the search form, it show the path somethink
like '/cgi-bin/gl/newsletter.cgi'

newsletter.cgi proccess the search and redirect to the PDF. Could it
be that Firefox considers it as a cgi file?

Any ideas, please?

Thanks much in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top