Download to .pages

  • Addos
  • Novice
  • Novice
  • Addos
  • Posts: 22

Post 3+ Months Ago

Using the following PHP code to download table content into a .doc woks fine on Windows but on a Mac it give the error message. “Sorry Pages can’t open this for some reason”.


PHP Code: [ Select ]
<?PHP header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment; Filename=blah-blah.doc”);
?>
  1. <?PHP header("Content-type: application/vnd.ms-word");
  2. header("Content-Disposition: attachment; Filename=blah-blah.doc”);
  3. ?>



Tried various versions using quote's "Filename=blah-blah.doc” "

I have tried multiple ways around this including using .rtf, .pdf, .csv (.cvc works but is not usable) but none will open in Pages. I even tried converting the headers from .doc to .pages but again nothing. If I simply click on a word document it opens fine in Pages so its not a local issue as far as I can see. The content in the database is just text with nothing else and I can easily echo this to a .php page so there is something within the headers that .pages seems to need. Anyone ever dealt with this for Pages before? Nothing is coming up on the web despite a day of searching.

I'm beginning to think this is not possible. I even considered using
PHP Code: [ Select ]
$fp = fopen("amit.doc", 'w+');
to get around this but even that won't open on a Mac.

Any ideas?

Thank you
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8489
  • Loc: USA

Post 3+ Months Ago

I've personally never had any experience with this as I've never had the need to perform such actions, but the following link might set you on the right track.

http://stackoverflow.com/questions/1884 ... ile-in-php
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 763
  • Loc: Conroe, Texas

Post 3+ Months Ago

Is it on the same type of browser?
  • Liamw411
  • Beginner
  • Beginner
  • Liamw411
  • Posts: 42
  • Loc: United Kingdom

Post 5 days ago

Hi, not really a mac user so I am unable to test this unless I set up a virtual machine.

Is it not possible to install microsoft office on your mac and use it as your default editor?.

you mentioned that you've tried different variations with the filename in quotes, when you did this, you did escape the quotes didn't you?.

I would also try:
Code: [ Select ]
header("Content-Type: application/octet-stream");

Code: [ Select ]
header('Content-Transfer-Encoding: binary');

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 46 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.