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

Publié le: 03 août 2020
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne Rename Image while uploading using phpinfo in PHP | Move uploaded File Function durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Knowledge Thrusters 03 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 11,514 fois et il a aimé 157 téléspectateurs. Bon visionnage!