Solved

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

Posted on 2013-05-24
2
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
count number 10 29
Excel Index/Match issue 4 15
Create a list of Worksheets based on Cell Value 14 24
Can't Find The Code 15 19
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article discusses how to create an extensible mechanism for linked drop downs.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 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