rhythmatik Posted May 22, 2008 Share Posted May 22, 2008 Okay, so I know basic php.. and I figured their would be a script already made that I could just alter.. But I couldn't find anything.. so I'll ask you guys for help! I need a script that does the following or need to know how to code my own to do the following: user fills in the designated input boxes user then clicks 'generate' script generates a txt or .cfg file script outputs file for download.. not in a txt box just generates a link for user to download the .cfg or .txt file. Thanks for your help in advance! cj Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 22, 2008 Share Posted May 22, 2008 Well, the first step is to create the form in HTML. The next step is to gather that information and put it into a text file. You'll need the fopen[/ur] and fwrite functions for that. You may also wish to perform some validation on the data prior to it being written to the text file. To require the file to be downloaded, you'll need to send certain headers and use the readfile function. This process is described here. p.s. Welcome to the forums. Quote Link to comment Share on other sites More sharing options...
rhythmatik Posted May 22, 2008 Author Share Posted May 22, 2008 using the tempnam function could I have the input written to a temp. file? Because I think if I just use the fopen fwrite functions to a single file.. then no more than one person could use the script at once.. is that correct? Quote Link to comment Share on other sites More sharing options...
mlin Posted May 22, 2008 Share Posted May 22, 2008 instead of saving the temp config files on your server's disk, consider reading the file to the browser as a dl rather than presenting a link. In the long run it'll be easier on you, and your users (eliminating the click step. The user will submit the form and file will be read to their browser as a download) Quote Link to comment Share on other sites More sharing options...
rhythmatik Posted May 22, 2008 Author Share Posted May 22, 2008 and I would do that by modifying the headers? Quote Link to comment 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.