views:

33

answers:

1

On my application, the user needs to click on a file name, and then the user is supposed to choose either to download the file or open it. I put code for it that is working fine for .doc, .txt extentions yet it is not working fine for .docx

My code is the following:

 @header('Location:'.$attachment_path);

Any idea of how to do it so it will work for all kind of attachment?

+1  A: 

Thanks I found out a solution.

print "Content-Type:application/x-download\n";

print "Content-Disposition:attachment;filename=$ID\n\n";

zeina
Second line only. Keep the real content-type, not a made up one.
David Dorward