简体   繁体   中英

How to rename the downloaded file with extension

I am able to rename the downloaded attachments with image1 , image2 .... n so on.

but it is only displaying a blank file , and renaming with the name... but how to give extension to display the attachment?

I am using rename function which is working for my code,

how will I add extension?

rename($image, $all);

(renaming downloaded file with the above mentioned names)

Try to just give extension to your name:

rename($image, $newtname.'.jpeg')

or

rename($image, $newtname.'.png')

etc.

尝试

rename($image, $all.'.jpg'); // you can change to any extension you like

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM