Rename Image while uploading using phpinfo in PHP | Move uploaded File Function

Publicado el: 03 agosto 2020
en el canal de: Knowledge Thrusters
11,514
157

This PHP Tutorial explains how to rename a file while uploading and insert the same name in database in php.

Steps:
Create a form for file upload
Create a db file
rename file
move to folder
insert into database

Before renaming , get the extension of the image. For that I have used phpinfo with option extension. As that will return the extension of the file uploaded.

Phpinfo has 4 elements - directory name, basename, extension and filename.
if option is not defined, it will return array, else it will return string.

For rename, I have passed string and current date combined with randomno so that no two image will have same name.

After rename, move to folder with move_uploaded_file function in which file temporary name and directory name will be passed.

If uploaded in folder, then insert that into database table.


If you are downloading code, Create a folder upload in your project folder
Code link
https://github.com/sushma-singh-yadav...


#php #knowledgethrusters


En esta página del sitio puede ver el video en línea Rename Image while uploading using phpinfo in PHP | Move uploaded File Function de Duración hora minuto segunda en buena calidad , que subió el usuario Knowledge Thrusters 03 agosto 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 11,514 veces y le gustó 157 a los espectadores. Disfruta viendo!