Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Template Shares
Reply
Thread Tools
  #1  
Old 13th January 2010, 21:23
saggy00 saggy00 is offline
Senior Member
 
Join Date: Jul 2009
Greece
Posts: 35
Default Rename on upload(ts gallery)
Hello guyw. I have tsse 5.4.1 and i have installed gallery plugin. The problem is the users have uploaded plenty of pictures and now is difficult to find an easy name for your pictures. How can i rename the photos on upload and give them a number(1,2,3...)which(the number) will ascend???
Reply With Quote
  #2  
Old 16th January 2010, 16:20
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default
PHP Code:
  //This line assigns a random number to a variable.  You could also use a timestamp here if you prefer. 
$ran rand () ;

 
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 $ran.".";

  
//This assigns the subdirectory you want to save into... make sure it exists!
$target "images/";  //This combines the directory, the random file name, and the extension
$target $target $ran2.$ext
PHP Code:
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
    echo 
"The file has been uploaded as ".$ran2.$ext;

else
{
    echo 
"Sorry, there was a problem uploading your file.";
}
   
?> 
Try that somewhere....
Reply With Quote
  #3  
Old 16th January 2010, 16:28
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
you well want to run a check to make sure that # dose not exsest already!
some thing like this
Code:
$cnt = 1;
do {
if(!is_file($target = $target . $ran2.$ext;))$cnt = 0;
} while ($cnt > 0);
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #4  
Old 16th January 2010, 18:39
saggy00 saggy00 is offline
Senior Member
 
Join Date: Jul 2009
Greece
Posts: 35
Default
Thanks guys!! I'll try it
Reply With Quote
Reply

Tags
gallery , rename , uploadts


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove or rename Powered by TS Special Edition v.4.3 UzAkLArDaN Template Shares 12 28th November 2013 22:20
Photo gallery for TS v 5.1 zenja7777 Template Shares 3 17th August 2008 22:10
How to Remove or Rename v1.3.1 by xam in Forums D3SI Template Shares 1 23rd June 2008 22:12



All times are GMT +2. The time now is 18:51. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.