Thanks Josh for noticing that typo. unfortunately that's not the problem.
I simply cut'n'pasted the wrong version of code yesterday (I had many different attempts with various methods and I tried at the end to have a separate case for PDF which at the end I aborted forgotting to change it back to 'eq'). My original correct code is: if (-B $file) { #binary file... $file =~ m|(.*/)(.+)\.([^\.]+)$|; my $ext = $3; my $mimetype; #most common mime types if (uc($ext) eq "PDF") { $mimetype="application/pdf";} elsif (uc($ext) eq "DOC") { $mimetype="application/msword";} elsif (uc($ext) eq "PPT") { $mimetype="application/powerpoint";} elsif (uc($ext) eq "ZIP") { $mimetype="application/x-zip-compressed";} elsif (uc($ext) eq "EXE") { $mimetype="application/octet-stream";} elsif (uc($ext) eq "EPS") { $mimetype="application/postscript";} elsif (uc($ext) eq "PS") { $mimetype="application/postscript";} elsif (uc($ext) eq "GZ") { $mimetype="application/x-gzip";} elsif (uc($ext) eq "LATEX") { $mimetype="application/x-latex";} elsif (uc($ext) eq "TAR") { $mimetype="application/x-tar";} elsif (uc($ext) eq "EXE") { $mimetype="application/octet-stream";} my $size = -s "$file"; open(INFILE, "$file") || die &img_not_found; binmode(INFILE); binmode(STDOUT); print "Content-type: $mimetype\n\n"; while (<INFILE>) { print $_; } close(INFILE); } #binary mode file The mime type is correctly set (I am sure as I debugged it step by step and printed out everything at each step). The output (downloaded file) is perfectly working for .doc files and for .zip files (the ones I tried). But for PDFs, the output is all the time a 2kb with the PDF header and binary parts. But nothing to do with the original PDF. Any suggestions? I tried with an IIS server on WinNT and Sambar server on WinNT. Can anyone test the code above or give further suggestions? Thanks _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs