MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 30th, 2005, 03:28 AM
rj2284 rj2284 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 3 rj2284 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 50 sec
Reputation Power: 0
MYSQL blob file download IE problem

Hi

I wondered if anyone had played around setting up a MYSQL database with blob fields for saving binary files.

I have done this myself, using a PHP web interface to upload/download. the only problem i have occurs when downloading on a windows machine using Internet Explorer.

When the usual download dialog box pops up prompting the user to OPEN or SAVE the file, if the user clicks OPEN, the file is downloaded (to a temporary destination) and then subsequently "lost". ie the appropriate application would open and then report that the file was "not found" or similar. in contrast, if the user chooses SAVE then the file downloads without any problems. i also do not get this problem in any other browsers, eg mozilla, safari.

i am using the following headers to output:

header("Content-Disposition:attachment; filename=\"$filename\"");
header("Content-length: $size");
header("Content-type: $type");

any ideas would be greatly appreciated

cheers

rich

Reply With Quote
  #2  
Old August 30th, 2005, 05:08 AM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 4
Hi, I can remember that I had the same problem some time ago with online generated PDF-documents. Not sure what caused it though.

Anyhow, this works for me:

// Output the correct headers to force the 'download' option
header("Content-Type: application/pdf"); // seems to work for IE and NS
header("Content-Disposition: attachment; filename=document.pdf");
header("Content-Length: ".filesize($file));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");

Reply With Quote
  #3  
Old September 1st, 2005, 05:27 AM
rj2284 rj2284 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 3 rj2284 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 50 sec
Reputation Power: 0
amazing

yep, that worked

i wonder what causes it?

probably inferior programming on microsoft's part as usual.

thanks a lot, life saver!

rich

Reply With Quote
  #4  
Old September 1st, 2005, 05:36 PM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 4
Well ... one thing what differs are the extra quotes in your first header line. Maybe its just that.
The other headers are good to have to disable caching. The last header is almost always needed to force binary mode in stead of text.

Anyway, glad to be of help (H)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > MYSQL blob file download IE problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway