Page 1 of 1

How do you write a path to the hard disk in php?

Posted: Thu Nov 15, 2007 9:39 am
by moleculo
I'm trying to write a form that creates files and saves them to my hard drive.

Code: Select all

if(isset($_POST['submit'])) //form submitted
{ 
$file_directory = "???????"; //the directory you want to store the new file in
}
I don't want the $file_directory to save to server, I want it to save to my hard drive. What would I put for $file_directory or is there a totally different way to do that?

Posted: Thu Nov 15, 2007 10:12 am
by pickle
PHP is server-side - it can't really save to your hard drive. The closest you can get (which is actually pretty close) is to output a file. Do some Google searching for "PHP force download" to get an idea.

Also, please use [syntax="php"][/syntax] tags rather than [syntax=php][/syntax] tags when posting PHP code - it syntax highlights much nicer.