Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Auto Rename files
https://www.tinywebgallery.com/forum/viewtopic.php?f=13&t=3636
Page 1 of 1

Author:  GeRobert [ 20. Jan 2014, 10:20 ]
Post subject:  Auto Rename files

Hi,

Is there a way to rename the files automatically immediately before, or after upload? I would like to append a random number at the end of the file name.

Thanks, RĂ³bert

Author:  TinyWebGallery [ 20. Jan 2014, 14:43 ]
Post subject:  Re: Auto Rename files

Sure. Use a plugin
check
http://www.tinywebgallery.com/en/tfu/web_plugin.php
prefix plugin. you can easily change this to add a random number.

Best, Michael

Author:  GeRobert [ 21. Jan 2014, 10:03 ]
Post subject:  Re: Auto Rename files

It works perfectly!

I wrote this:
$prefix= rand(10000,99999);

$ext= pathinfo($filename, PATHINFO_EXTENSION);
$base= pathinfo($filename, PATHINFO_FILENAME);

$exchangefilename= dirname($fullpath). '/'. $base. '_'. $prefix. '.'. $ext;

Thanks, Michael!

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/