<?
$folder_name = $_POST['name'];
mkdir("/path/$folder_name", 0777);
?>
i think the above code makes a directory as the user inputs the folder name...
Now, what i want is, if the user gives space in between the text like "my design works" then i want this text to renamed to "my_design_works"
..
so how to do that??
and if that folder exists then i want the new folder to be renamed automatically with new name...
i know i m very bad at PHP so..
waiting for your help guys....
remove spaces
Moderator: General Moderators
Re: remove spaces
There are 10 types of people in this world, those who understand binary and those who don't
Re: remove spaces
do you mind if you please post the code... coz i m so new to PHP..... please.....
Re: remove spaces
Try to figure out the code - if you don't succeed, post the code you are trying with and I'll help you.kanchan wrote:do you mind if you please post the code... coz i m so new to PHP..... please.....
There are 10 types of people in this world, those who understand binary and those who don't
Re: remove spaces
VladSun wrote:Try to figure out the code - if you don't succeed, post the code you are trying with and I'll help you.kanchan wrote:do you mind if you please post the code... coz i m so new to PHP..... please.....
if i was that much good then i wudnt have posted here...
anyways..i find out the code .... thanks...
Re: remove spaces
Now what i want is if it founds the folder name already exists then i wanna rename the new folder to user inputted name with random numbers at the last...
<?php
$name = '/path/foldername;
if (file_exists($name)) {
rename the folder like this : my_design_works12312312 ;
} else {
mkdir("/path/$folder_name ", 0777);
}
?>
<?php
$name = '/path/foldername;
if (file_exists($name)) {
rename the folder like this : my_design_works12312312 ;
} else {
mkdir("/path/$folder_name ", 0777);
}
?>