How to rename files name under DB and folder with alphanumeric unique? |
04-30-2021, 01:39 PM
(This post was last modified: 04-30-2021, 01:41 PM by volkankaban. Edit Reason: icon )
I'm using CodeIgniter 3 for a small project. I want to keep all the file names with alphanumeric unique, under the "attach" column and continue to keep original names under the "attachorg". How can I rename file names with unique under the DB:questions; attach and /documents/questions/attach/ folder?
ex: $this->load->helper('string'); echo random_string('alnum',20); DB:questions, columns:id(Primary, Auto_Increment),title(varchar),desc(longtext),attach(longtext),attachorg(longtext),created_date(datetime), updated_date(datetime) column:attach 1141507731454140.zip!@#||&?@!142352919172411.zip!@#||&?@!141507731462752.zip!@#||&?@!141507731449563.zip!@#||&?@!141507731489804.zip!@#||&?@!141507731490275.zip 1531201652-12733_BUSMade__Theory_.docx 141515795079070.docx!@#||&?@!141515795044971.docx 1531201652-12737FORD_User_Manual_Help_Decisions.docx NULL 141515790754990.docx 141515762648650.pptx NULL 141927002196910.docx!@#||&?@!141927002168841.docx 141882873043050.xlsx!@#||&?@!141882873041151.docx NULL 157152903755090-File_of__New_Member_.docx 1531201654-13234COVID_Article_2.docx 9932148760.xlsx!@#||&?@!141909932167921.docx 141909953540020.docx!@#||&?@!141909953547481.xlsx Folders; /application /system /documents/questions/attach/ 141507731449563.zip 141507731454140.zip 141507731462752.zip 141507731489804.xls 141507731489804.zip 141507731490275.doc 141507731490275.zip 141515762648650.pptx 141515790754990.docx 141515790754990.ppt 141515795044971.docx 141515795079070.docx 141882873041151.docx 141882873043050.xlsx 141909932167921.docx 141909953540020.docx 141909953540020.pdf 141909953547481.xlsx 141927002168841.docx 141927002168841.txt 141927002196910.docx 142352919172411.zip 1531201652-12733_BUSMade__Theory_.docx 1531201652-12737FORD_User_Manual_Help_Decisions.docx 1531201654-13234COVID_Article_2.docx 157152903755090-File_of__New_Member_.docx 9932148760.xlsx
PHP.net - rename
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |