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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
moleculo
Forum Newbie
Posts: 18
Joined: Thu Nov 15, 2007 9:05 am

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

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply