FredFredrickson Posted June 6, 2006 Share Posted June 6, 2006 I have a game I'm working on where you can store small bits of data up on a MySQL managed PHP server, and then go browse to the site via the net and see what other people have created. I want the users to be able to click on any of the items that have been uploaded (which are just stored as data in my MySQL database) and be able to download them in all together in a text file with a custom extension, which I want a download dialog box to appear for.Since the content will constantly be changing, it seems silly to have the script actually generate files to download... but I'm not sure how I could have it pull the data together when the user clicks an item to download. Is there some way to 'trick' the browser into thinking it's supposed to be downloading a file when in actuality php is just building the data for it and passing it along as a file? I'm not sure if I can explain this clearly enough...! Hope someone understands! [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/11299-create-files-as-you-download-them/ Share on other sites More sharing options...
akitchin Posted June 6, 2006 Share Posted June 6, 2006 this is just like sending an actual file to the browser through PHP for downloading, except that instead of reading the file itself out to the browser, you read the content.have a look on google for "php header download" or "php download script"; there are even a few examples in the PHP manual (under header()) for sending automatic download cues to the browser. with some hacking together of the bits and pieces, you can create a downloading script like this (i did, except that i was sending actual files for download).hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/11299-create-files-as-you-download-them/#findComment-42306 Share on other sites More sharing options...
FredFredrickson Posted June 6, 2006 Author Share Posted June 6, 2006 Thanks a lot, I'll give it a look! Quote Link to comment https://forums.phpfreaks.com/topic/11299-create-files-as-you-download-them/#findComment-42307 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.