Solved

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

Posted on 2013-05-24
2
331 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 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
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
Comment Utility
@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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now