473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. function upload_form(){
  3. ?>
  4.       <table border = "1" align="center">
  5.       <tr><td>
  6.       <form   method="post" enctype="multipart/form-data" action="<? echo $_SERVER['PHP_SELF']?>">
  7.       <input type ="file" name="userfile">
  8.       <input type="submit" name="action" value="upload">
  9. </form>
  10. <td></tr>
  11. </table>
  12. <? 
  13. }
  14. function upload_file(){
  15.       $uploaddir="D:\personal\source code";
  16.       //echo "$uploaddir";
  17.       $userfile_name=$_FILES['userfile']['name'];
  18.       //echo "$userfile_name";
  19.       $userfile_tmp_name=$_FILES['userfile']['tmp_name'];
  20.       $userfile_size=$_FILES['userfile']['size'];
  21.       $userfile_type=$_FILES['userfile']['type'];
  22.  
  23.       if(isset($_ENV['WINDIR'])){
  24.            // $userfile=str_replace("\\\\","\\",$_FILES['username']['name']);
  25.       }
  26.       $filename=basename($userfile_name);
  27.       if($userfile_size<=0) die("$filename is empty.");
  28.       if(!$move_uploaded_file($superfile_tmp_name,"$uploaddir/$filename"))
  29.             die("Cannot copy $userfile_name to $filename");
  30.       if(isset($_ENV['WINDIR']) && ! unlink($userfile))
  31.             die ("Cannot delete the file $userfile_name.");
  32.       echo "$filename has successfully uploaded.<BR>";
  33.       echo "filesize: ".number_format($userfile_size)."<BR>";
  34.       echo "filetype: $userfile_type<BR>"; 
  35.  
  36. }
  37. ?>
  38.  
  39.  
  40. <html>
  41. <head>
  42. <title>Uploading a file to remote server</title>
  43. </head>
  44. <body>
  45. <?php
  46. if($_POST[action]=='upload'){
  47.       upload_file();
  48. }else {
  49.       upload_form();
  50.   }
  51. ?>
  52. </body>
  53. </html>
Jun 30 '08 #1
7 7569
Markus
6,050 Expert 4TB
Hey there.
Check out this tutorial.
Jun 30 '08 #2
thanks mark. I will try
Jul 2 '08 #3
Markus
6,050 Expert 4TB
thanks mark. I will try
Post back if you need help.
Jul 2 '08 #4
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
Jul 7 '08 #5
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.
Jul 7 '08 #6
Markus
6,050 Expert 4TB
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.
Jul 7 '08 #7
Markus
6,050 Expert 4TB
Do not double post.
Jul 7 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Evgeny Zoldin | last post by:
Hi ALL. I would like to download file from some web-server that requires Basic-Authetication, change somthing in the file and upload it back to the server. I can download the file and proceed...
3
by: Sarav | last post by:
Hi All, I need to upload an XML file via an client side ActiveX control. I searched the web but everywhere got the samples of using file control alone. How can I upload a file into my web server...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
1
by: theburnetts | last post by:
I am building an ASP.NET application that has a requirement that the user should be able to download all of the data that they have input into the system and save it to a file on their local PC. ...
4
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
4
by: abhanjee | last post by:
Hello, I am a newbie and am developing an application for work. I have figured out how to upload a file attachment to the SQL database and download the same file using C# and Visual Studio....
2
by: fReDiNi | last post by:
Hi, I have being trying fo find the best solution for this problem for 2 days now and I am not able to find a solution.I need help. I explain the problem: A customer needs a system so that...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
1
by: lPrentice | last post by:
Hello, After all this time, Linux file permissions still confuse me at times. I have a Python web-based application with an file (images) upload module. The application is running on two remote...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.