This can be a really challenging problem!
One way is to use ftp, storing it on another host entirely. (kind of over-kill)
Another way, for unix anyway, is something called the Set-ID bit. When a program with this bit set is run, it becomes the files owner. (it becomes the userid of the one who owns the executable file)
This doesn't work well for embedded languages (like php) but it does work for some other languages, on some platforms. (perl, c are examples, but for perl to work, it needs to be enabled with sperl)
Be careful with set-id, it can backfire on you, and has been the enabling factor of more than a few security problems.
If you're not concerned about the file contents and you're willing to take some risks.. on unix hosts, you can make a directory world writable.
chmod 777 data/
However, if you do this, anyone can put files in there (and if the web server is running as a common user for all requests, other people may be able to read the files)
All of these things depend on the platform in question and what facilities it supports.
What I think we really need is a web servers equivelant of a "home" directory for the site owner, or at least, something like WEB-INF/ of the servlet world.