Reply to Re: [PHP] writing to file

Your name:

Reply:


Posted by Jochem Maas on 10/04/25 11:23

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 :-)

>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация