473,461 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 7571
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.