Jump to content

tested_123

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tested_123's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello all, i have a one more problem regarding file renaming.Now wat i have to do is that there are subfolders(may be 1 or 2 or 3...) inside a folder and that subfolders contain several files.Now wat i want is that if i enter old filename in a textbox(that file can be present in any of the subfolder but we don't know in which subfolder it is present) and in another text box if i give new filename the "file rename" program must searches for that file placed in any of the subfolders and then rename it.........itz a typical program i think......can anybody help me doing this............
  2. thanx i have converted the code into function ............here it goes.............. <?php $oldFileName=$_POST['oldFileName']; $newFileName=$_POST['newFileName']; function rname($dir,$oldFileName,$newFileName) { $r= rename($dir.$oldFileName,$dir.$newFileName); return $r; } if(isset($_POST['sub'])) { $dir='upload/'; $dh = opendir($dir) or die ("Unable to open the directory"); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file == "." || $file == "..") { continue; } if($oldFileName==$file) { $found="true"; $var=rname('upload/',$oldFileName,$newFileName); echo "file ".$oldFileName." has been renamed to " .$newFileName."<br."; } else { $found="false"; } } } } if($found=="false") { echo "entered file does not exist in specified folder"; } } ?> <form name="frm" method="post" action="rename_1.php"> <table width="350" align="center" cellpadding="0" cellspacing="0" border="0"> <tr> <td>Enter file name to be renamed : </td> <td><input type="text" name="oldFileName" size="20"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Enter new file name: </td> <td><input type="text" name="newFileName" size="20"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td></td> <td><input type="submit" name="sub" value="Submit"></td> </tr> </table> </form>
  3. hi all, i want to rewrite following "file rename" code using a function.i am not good in using a function....please help me in converting this code into function <?php $oldFileName=$_POST['oldFileName']; $newFileName=$_POST['newFileName']; //function rname($dirpath,$oldFileName,$newFilename) //{ // } if(isset($_POST['sub'])) { // print_r($file); $dir='upload/'; $dh = opendir($dir) or die ("Unable to open the directory"); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file == "." || $file == "..") { continue; } if($oldFileName==$file) { // $file=$newFileName; rename($dir.$oldFileName,$dir.$newFileName); echo "file".$oldFileName." has been renamed TO " .$newFileName; } echo "<br>"; unset($_POST); } } } } //} ?> <form name="frm" method="post" action="rname.php"> <table width="400" align="center" cellpadding="0" cellspacing="0" border="0"> <tr> <td>Enter file name to be renamed : </td> <td><input type="text" name="oldFileName" size="30"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Enter new file name: </td> <td><input type="text" name="newFileName" size="30"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td></td> <td><input type="submit" name="sub" value="Submit"></td> </tr> </table> </form> (edited by kenrbnsn to add tags)
  4. no that links are not working as needed...........wat i want is i there will be two text boxes in first i will enter old file name and in other text box i will enter new and when i press submit it must change the old filnename to new file name in a directory
  5. thanx for the link .................one link out of them can help me .........let me see if it works for me or not
  6. i have to do it using recursive function which i have written above
  7. i have to rename a file placed inside a folder and i have to rename it using a function and not just have to use "rename" function.i have to make a function like this function rename($dirpath,$oldfilename,$newfilename) and this function must be recursive and a directory can contain subdirectory also.the opration will be like this...... there will a text box where i will enter old file name and in another text box i will enter new file name and when i press submit it will rename that file placed inside that folder........i need it urgently thanx in advance
  8. how to make a navigating calendar in php with css stles implemented on it?????
  9. hi, i am new to php and i want to make a navigating calendar in php with CSS implemented on it.....can anyone help me doing this..thanx in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.