Note that there are some explanatory texts on larger screens.

plurals
  1. POMongodb GridFS having trouble downloading .ppt and .doc files?
    primarykey
    data
    text
    <p>I have this function in my controller to download files that i am storing in my mongodb grid:</p> <pre><code>function download_presentation($ext,$store_filename) { $grid = $this-&gt;mongo-&gt;db-&gt;getGridFS(); //query the file object $objects = $grid-&gt;find(); //set content-type header, output in browser switch ($ext) { case 'pdf': $mimeType = 'Content-type: application/pdf'; break; case 'jpg': $mimeType = 'Content-type: image/jpg'; break; case 'png': $mimeType = 'Content-type: image/png'; break; case 'doc': $mimeType = 'Content-type: application/msword'; break; case 'docx': $mimeType = 'Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document'; break; case 'xls': $mimeType = 'Content-type: application/vnd.ms-excel'; break; case 'xlsx': $mimeType = 'Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; break; case 'ppt': $mimeType = 'Content-type: application/x-mspowerpoint'; break; case 'pptx': $mimeType = 'Content-type: application/vnd.openxmlformats- officedocument.presentationml.presentation'; break; default: $mimeType='Content-type: application/pdf'; } while($object = $objects-&gt;getNext()) : if(($object-&gt;file['filename'])==$store_filename){ $content=$object-&gt;getBytes(); header("Content-Length: " . strlen($content)); header($mimeType); echo ($content);} endwhile; </code></pre> <p>} Whenever i am downloading .ppt files it is saying PowerPoint can't open this file beacuse it is not .ppt. For pptx files when i open it after downloading ,it is working when i am clicking on 'repair' pop up from PowerPoint.Same thing is happening with .doc/MS-Word.Only pdf files are running perfectly. Can anyone please tell me what is the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload