Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

my PHP code generate XML: I want to add some code to get a PowerPoint

Posted on 2013-05-24
2
Medium Priority
?
346 Views
Last Modified: 2013-05-26
Hi,


I did an xml file for power point
The problem is my CEO wants not to download XML file he wants me to convert in normal Power Point.

Here is the code I've found on the Internet Google search  I have try to rename but it is not OK.


Can some one give me the code Please for that



<?php

// Extensions des fichiers autorisés à être téléchargés, à modifier. Sans les points.
$exts_allowed = array ( 'xml','txt' , 'htm' , 'html' , 'phtml' , 'xhtml' , 'dhtml' );


//----------------------------------------------------
// MESSAGES D'ERREUR
//----------------------------------------------------

$msg [ 'no_file_to_dl' ]      =  'Aucun fichier à télécharger.';
$msg [ 'file_doesnt_exist' ]  =  'Le fichier que vous tentez de télécharger n\'existe pas.';
$msg [ 'file_not_allowed' ]   =  'Vous ne pouvez pas télécharger ce fichier.';

//echo "*".$_GET [ 'file' ];




$_GET [ 'file' ]="OUTPUT.xml";
//$_GET [ 'file' ]="PBE_STAT_CRM_MASK_STEP1_REELLES_MASK_P2_V1OKREELLE_V3.xml";
if ( isset ( $_GET [ 'file' ] ) )
{
      $file = trim ( $_GET [ 'file' ] );
     
      if ( @ file_exists ( $file ) )
      {
            $infos = pathinfo ( $file );
           
            if ( in_array ( $infos [ 'extension' ] , $exts_allowed ) )
            {
            @ header ( 'Content-Transfer-Encoding: binary' );
            @ header ( 'Content-Disposition: attachment; filename="' . str_replace ( ' ' , '_' , $file ) . '"');
            @ header ( 'Content-Length: ' . @ filesize ( $file ) );
            @ readfile ( $file );
            }
            else
      {
                  echo $msg [ 'file_not_allowed' ];
            }
      }
      else
      {
            echo $msg [ 'file_doesnt_exist' ];
}
}
else
{
      echo $msg [ 'no_file_to_dl' ];
}

rename ( "OUTPUT.xml" , "OUTPUT.pptx");


?>
0
Comment
Question by:DavidInLove
2 Comments
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 1500 total points
ID: 39196211
You can have this file open directly in powerpoint by sending the appropriate content-type header. Leave the file as .XML but then add this to your header statements

@header("Content-type: application/vnd.ms-powerpoint");

Look here for additional MS mime types

http://filext.com/faq/office_mime_types.php
0
 

Author Closing Comment

by:DavidInLove
ID: 39198442
@julianH

I have tried that (add what you said at the beginning of my xml file) but it is not OK


@header("Content-type: application/vnd.ms-powerpoint");
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="PowerPoint.Show"?>

Can you please explain further more please?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question