Re: writing to file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sebastian wrote:
i have this app where a user fills out a form and after submit it displays the values they entered. i want to save this info to a file after they submit, then allow them to download the file. some other user does the same, fills in the form and allow that person to download the file... and so on.

i don't know how i should go about doing this.. rather than keep creating files i would like to recycle the file each time someone uses the system, but that can lead to other problems.. like several users using the app at once..

any suggestion/ideas/tips how i should do this? basically, just write the info from POST to a file and allow them to download the file. obviously i am worried how secure i will be able to make this.

alot depends on whether the user will be allowed to download the file
only in the current session or at any time in the future.

also security has 2 sides - protection on the server (from other
people hosting on the same machine, and protection on the 'outside'
from unauthorized users trying to download other peoples files
(which would require some kind of login mechanism)

note that in order to give a user a file to download when he/she
clicks something does not require an actual file to exist ...
you could store the data ('file contents') in a DB and have a script
which when requested with the correct parameters (GET args) will
extract the data from the DB (or whereever) and output it with the
correct headers (to force a download)

there is lots of info out there on how to create/output headers to
tell a browser that it should download whatever is returned from a
request. have a search - chances are you'll find something

chances are also that you'll get stuck because of the way certain
browsers f*** up when given 'download' headers - I've found it as much
art as science in the past ;-) any way if this turns out to be the case
we'll be seeing you :-)




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux