Assume that I use php to receive files uploaded in the form. How can I rename the uploaded file (change it to its md5 value to prevent duplicate names) and retain the suffix. It is best to give a sample code that assumes that I use php to receive files uploaded in the form, How can I change the name of the uploaded file (change it to its md5 value to prevent duplicate names), and retain the suffix.
It is better to give a sample code
Reply content:
Assume that I use php to receive files uploaded in the form. How can I rename the uploaded file (change it to its md5 value to prevent duplicate names) and retain the suffix.
It is better to give a sample code
Assume that the form is as follows:
In this way, you can change the name:
$ Str = 'test. name ';
$ Pos = strrpos ($ str ,'.');
Echo substr_replace ($ str, md5 (substr ($ str, 0, $ pos), 0, $ pos );
It's hard to write code on a mobile phone...