473,406 Members | 2,769 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,406 software developers and data experts.

Problem in downloaded file

13
Hello Everyone,

While i'm downloading a file it will correctly downloaded but contents of .doc file is doesn't display,but if i open .txt file that content has been displaying.


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_GET['id'])) 
  3. {
  4. // if id is set then get the file with the id from database
  5.  
  6. include ("includes/connectdb.php");
  7. $id    = $_GET['id'];
  8. $query = "SELECT up_filename, up_type, up_size, up_content FROM dms_upload WHERE id = '$id'";
  9.  
  10. $result = mysql_query($query) or die('Error, query failed');
  11. while($fetch = mysql_fetch_array($result))
  12.     {
  13. $filename=$fetch['up_filename'];
  14. $size=$fetch['up_size'];
  15. $type=$fetch['up_type'];
  16. $content=$fetch['up_content'];
  17.     }
  18.  
  19. header("Content-length: $size");
  20. header("Content-type: $type");
  21. header("Content-Disposition: attachment; filename=$filename");
  22. echo $content;
  23.  
  24. exit;
  25. }
  26.  
  27. ?>
Aug 10 '07 #1
1 1189
pbmods
5,821 Expert 4TB
Heya, Rajaaa.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Try using Content-type: force-download.
Aug 13 '07 #2

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

Similar topics

2
by: Senthoorkumaran Punniamoorthy | last post by:
I am printing these information. print string.lower(info_res) print string.lower(md5sum(f_md5)) print len(string.lower(info_res)) print len(string.lower(md5sum(f_md5))) print...
2
by: Paul | last post by:
Hi, I've been developing an application in VB.NET that uses the FileSystemWatcher and a popup notification in order to tell me when files have been downloaded. The FileSystemWatcher code in...
9
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit...
2
by: Theodoros.Savvides | last post by:
Hi All, We are developing an application and we have a problem for which I cannot find any information anywhere. The application consists of a windows user control and an ASP.NET application...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
0
by: santosh1234 | last post by:
Hi, I have a problem in importing from an excel file. I am using the connection string for oledb to convert the data from the excel file into a datatable and proceed thereafter. Code I am using...
4
by: PiotrKolodziej | last post by:
hi I have a thread that downloades a file. Problem is : Not all files are beeing downloaded. I observed that only the small files are beeing downloaded correctly. I also cant download two files...
5
by: Pitaridis Aristotelis | last post by:
I have a large file which has to be downloaded from a user using the Internet Explorer. The problem is that when someone downloads this file, the server slows down and the other users can not see...
0
by: george585 | last post by:
Hello! I am new to network programming, and understand just basics. Using some sample code, and having read documentation, I managed to create a simple app in C# and VB.NET. The application is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
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...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.