nielcleo Posted October 5, 2010 Share Posted October 5, 2010 i just wondering if it is possible in php to create a folder in a specific path.for examplei click the button create folder after i click it it required to put a folder name i put it for example folder1..and path should root/myfolders/folder1if i create a new folder again the path is root/myfolders/folder2.should it be possible in php?? Link to comment Share on other sites More sharing options...
jeffman Posted October 5, 2010 Share Posted October 5, 2010 In most languages related to Unix in any way, the correct command is usually mkdir.Be sure to sanitize incoming data, or a malicious user may do all kinds of nasty things to your system.You mentioned the button click. Are you also unsure how how to get the correct data from the browser to the server? Link to comment Share on other sites More sharing options...
nielcleo Posted October 5, 2010 Author Share Posted October 5, 2010 thanks sir You mentioned the button click. Are you also unsure how how to get the correct data from the browser to the server?what do you mean about this sir?? Link to comment Share on other sites More sharing options...
jeffman Posted October 5, 2010 Share Posted October 5, 2010 I wondered if you had any other questions. Link to comment Share on other sites More sharing options...
nielcleo Posted October 5, 2010 Author Share Posted October 5, 2010 i read the mkdir and how can i create i folder name? Link to comment Share on other sites More sharing options...
jeffman Posted October 5, 2010 Share Posted October 5, 2010 The directory name can be anything you want. If you are getting the name from your user, you probably want to allow only certain characters, like letters, numbers, and the _ character. That usually means validating the name with a function that uses regular expressions, like preg_match.The other part of the question is the path to your directory. If your command looks like this: mkdir("something") then the directory will be created in the same directory as your PHP script. If you want the directory to be somewhere else, you will have to pass mkdir a longer path. That means knowing how your server's file system works and how you want your files and directories to be organized. Link to comment Share on other sites More sharing options...
nielcleo Posted October 5, 2010 Author Share Posted October 5, 2010 thanks sir Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.