|
Web design and Programming Discuss website creation and other programming topics. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
Getting binary data from MySQL to download into a zip
Sorry bout the long name...
Well anyways, now since ive got hte whole displaying an imge thing working, how would i get it so pretty much the same works with a zip file so the person (upon clicking hte link) will get the zip file to download? This is what i have so far and it just gives me a dl.php filled with the binary data lol... PHP Code:
__________________
![]() Free Teamspeak servers: http://gamersnetwork.us/ ![]() |
#2
|
||
|
Try storing at least the origional file extension on the database.. Then use the octet-stream.
Try something like this: $result=result("SELECT origional_name,extension FROM database WHERE map='$id'"); header("Content-Type: application/octet-stream"); header( "Content-Disposition: attachment; filename=$origional_name.$extension"); exit;
__________________
![]() 04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#3
|
||
|
ok it goes to a zip file now but doesnt have any data in it :-X
__________________
![]() Free Teamspeak servers: http://gamersnetwork.us/ ![]() |
#4
|
||
|
I'll look into it a bit more when I get home. I've never taken data outa a mysql db for file download.. I'll figure it out..
__________________
![]() 04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#5
|
||
|
Thanks panther :-D
right now with what you give me, i can get a zip file with the name from the datqabase, but not the data thats in it...
__________________
![]() Free Teamspeak servers: http://gamersnetwork.us/ ![]() |
#6
|
||
|
Code:
<? $result=result("SELECT * FROM filename,blob FROM table WHERE id='$id'"); header("Content-Disposition: attachment; filename=\"$result[filename]\""); // or try header("Content-Disposition: inline; filename=\"$result[filename]\""); header("Content-Length: ".strlen($result[blob])); header("Content-Type: application/octet-stream"); Echo($result[blob]); ?>
__________________
![]() 04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#7
|
||
|
you bloody rock Panther
i changed it just a lil so it would suit me header("Content-Disposition: attachment; // the $name and $data are already called form the database, just recalled the vars here filename=\"$name\".zip"); // .zip for file type header("Content-Length: ".strlen($data)); header("Content-Type: application/octet-stream");
__________________
![]() Free Teamspeak servers: http://gamersnetwork.us/ ![]() |
#8
|
||
|
I wrote a script for you in full if you run into a few more errors.. It has a few more explinations like how to do images etc.. Sorry for all the errors above, I wasen't testing anything I was writing.. But glad you got it to work!
![]() you'll have to change some things to test it out / play with it but it's a sample / play script for learning.
__________________
![]() 04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#9
|
||
|
__________________
![]() Free Teamspeak servers: http://gamersnetwork.us/ ![]() |
#10
|
||
|
gj bro
![]()
__________________
![]() 04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there any way to zip your maps without buying winzip?????? | EMPTY-07 | Delta Force | 7 | 03-04-2007 12:47 PM |
MIME TYPE for zip files? | BeBop | Tech Support | 5 | 12-12-2004 10:04 PM |
ZIP submission sizes. | zza1pqx | Feedback / Novahq.net Support | 0 | 09-23-2004 11:18 AM |
making a New face .zip | Hellfighter | Feedback / Novahq.net Support | 6 | 09-10-2003 08:18 PM |
Revised SwissImpressions.zip | EL_Bastardo UFP | Feedback / Novahq.net Support | 1 | 05-25-2002 06:41 AM |