Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 28th, 2004, 07:44 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
generate file

Hi,

I have some data in $data.
I want that when you go to export.php, $data in extracted into a file : extract.tab .

I first tried this:
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=extraction.tab");
header("Pragma: no-cache");
header("Expires: 0");
print $data;

It works fine with MOZILLA. But Internet Explorer is trying to make me download export.php instead of the extraction file !

So I tried this :
header('Content-Type: application/octet-stream');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if (PMA_USR_BROWSER_AGENT == 'IE') {
header("Content-Disposition: inline; filename='extraction.tab'");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header("Content-Disposition: attachment; filename='extraction.tab'");
header('Pragma: no-cache');
}

but the problem remains the same ...

What should I do?

Thank you,

Nathan

Reply With Quote
  #2  
Old June 28th, 2004, 10:46 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: generate file

check out the user comments on the php manual page for the function header()

one of those things should work..

Reply With Quote
  #3  
Old June 28th, 2004, 11:34 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: generate file

I already checked. Didn't find anything that helped me...

Reply With Quote
  #4  
Old June 30th, 2004, 12:24 AM
skay_t skay_t is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 42 skay_t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: generate file

php Code:
Original - php Code
  1.  
  2.  
  3. //try this
  4.  
  5. header("Content-Type: application/force-download");
  6. header('Accept-Ranges: bytes');
  7. header('Content-Length: ' . filesize("extraction.tab"));
  8. header('Connection: close');
  9. header('Content-Disposition: attachment; filename="extraction.tab"');
  10. readfile("extraction.tab");
  11.  

Reply With Quote
  #5  
Old June 30th, 2004, 06:02 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: generate file

extraction.tab is not a file pre-existing.
all the data is in $data, so I cannot filesize it, or readfile it.

Reply With Quote
  #6  
Old June 30th, 2004, 06:37 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: generate file

Hey thanks,
I adapted your script to my problem, and it works !

$filename = "mmhorders-".$fromM."-".$fromD."-".$fromY."-".$toM."-".$toD."-".$toY.".tab";
header("Content-Type: application/force-download");
header('Accept-Ranges: bytes');
header('Connection: close');
header("Content-Disposition: attachment; filename=$filename ");
print $data;

Thank you,

Nathan

Reply With Quote
  #7  
Old June 30th, 2004, 07:46 PM
skay_t skay_t is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 42 skay_t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: generate file

Hi, just as an added extra I would then suggest you add this

php Code:
Original - php Code
  1.  
  2.  
  3. header('Content-Length: ' . strlen($data));
  4.  

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > generate file


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 5 hosted by Hostway
Stay green...Green IT