dannybrazil Posted April 4, 2008 Share Posted April 4, 2008 Hello i wanted to know if i can rename a file that been uploaded to my database(the path only)? doesnt matter what is the name after can be numbers or letters (random i suppose) thanks Quote Link to comment https://forums.phpfreaks.com/topic/99598-image-file-renaming-after-user-uploaded/ Share on other sites More sharing options...
benjaminbeazy Posted April 5, 2008 Share Posted April 5, 2008 move_uploaded_file($_FILES["NAME_OF_FILE_FIELD_IN_YOUR_FORM"]["tmp_name"], "upload/" . $somename); Quote Link to comment https://forums.phpfreaks.com/topic/99598-image-file-renaming-after-user-uploaded/#findComment-509822 Share on other sites More sharing options...
dannybrazil Posted April 5, 2008 Author Share Posted April 5, 2008 hello this is my code of moving the file to the Dir' how can i add to the file name the ID# in the table (where the path is stored ) and like that they will never have the same names //--------- Move the files to destination---------------- $nduploadfolder1 = basename($nduploadfolder); for ($i = 0; $i < count($upload_Name); $i++) { if ($upload_Size[$i] < $ndfilesize1 and $upload_Size[$i] >0) { $uploadFile = "$nduploadfolder1/".$upload_Name[$i]; if (!is_dir(dirname($uploadFile))) { @RecursiveMkdir(dirname($uploadFile)); } else { @chmod(dirname($uploadFile), 0777); } @move_uploaded_file( $upload_Temp[$i] , $uploadFile); chmod($uploadFile, 0644); } } Quote Link to comment https://forums.phpfreaks.com/topic/99598-image-file-renaming-after-user-uploaded/#findComment-510048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.