ppt file upload and download

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rubelpasha
    New Member
    • Jun 2008
    • 6

    ppt file upload and download

    How i can upload a ppt file and store it to some database and later download it.
    I have a code for uploading a txt file but id doesn't work. Plz help me in this regard.
    here is the code...
    [code=php]
    <?php
    function upload_form(){
    ?>
    <table border = "1" align="center">
    <tr><td>
    <form method="post" enctype="multip art/form-data" action="<? echo $_SERVER['PHP_SELF']?>">
    <input type ="file" name="userfile" >
    <input type="submit" name="action" value="upload">
    </form>
    <td></tr>
    </table>
    <?
    }
    function upload_file(){
    $uploaddir="D:\ personal\source code";
    //echo "$uploaddir ";
    $userfile_name= $_FILES['userfile']['name'];
    //echo "$userfile_name ";
    $userfile_tmp_n ame=$_FILES['userfile']['tmp_name'];
    $userfile_size= $_FILES['userfile']['size'];
    $userfile_type= $_FILES['userfile']['type'];

    if(isset($_ENV['WINDIR'])){
    // $userfile=str_r eplace("\\\\"," \\",$_FILES['username']['name']);
    }
    $filename=basen ame($userfile_n ame);
    if($userfile_si ze<=0) die("$filename is empty.");
    if(!$move_uploa ded_file($super file_tmp_name," $uploaddir/$filename"))
    die("Cannot copy $userfile_name to $filename");
    if(isset($_ENV['WINDIR']) && ! unlink($userfil e))
    die ("Cannot delete the file $userfile_name. ");
    echo "$filename has successfully uploaded.<BR>";
    echo "filesize: ".number_format ($userfile_size )."<BR>";
    echo "filetype: $userfile_type< BR>";

    }
    ?>


    <html>
    <head>
    <title>Uploadin g a file to remote server</title>
    </head>
    <body>
    <?php
    if($_POST[action]=='upload'){
    upload_file();
    }else {
    upload_form();
    }
    ?>
    </body>
    </html>[/code]
    Last edited by pbmods; Jul 2 '08, 12:56 AM. Reason: Added code tags.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Hey there.
    Check out this tutorial.

    Comment

    • rubelpasha
      New Member
      • Jun 2008
      • 6

      #3
      thanks mark. I will try

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by rubelpasha
        thanks mark. I will try
        Post back if you need help.

        Comment

        • rubelpasha
          New Member
          • Jun 2008
          • 6

          #5
          ppt file uploading/downloading

          hi all,
          I want to upload a ppt file to a database and download it by using php. can anyone help me?? plz, i m in trouble.

          i can do this with atxt file. but in case of ppt id doesn,t work

          Comment

          • rubelpasha
            New Member
            • Jun 2008
            • 6

            #6
            Hello mark,
            I read this tutorial. But there is nothing for ppt file uploading and downloading. I think i cant extract the header of ppt file.

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Originally posted by rubelpasha
              Hello mark,
              I read this tutorial. But there is nothing for ppt file uploading and downloading. I think i cant extract the header of ppt file.
              The downloading and uploading of a ppt file should be no different than the downloading and uploading of an image file; same principles.

              The tutorial gives you the tools needed to upload a file and download a file.

              Comment

              • Markus
                Recognized Expert Expert
                • Jun 2007
                • 6092

                #8
                Do not double post.

                Comment

                Working...