General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 1st, 2002, 10:01 PM
arnorg arnorg is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 13 arnorg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
rename the imagefile to the highest avilable number in DIR

Hello

I´m programming a image gallery, the uploaded pics should all be uploaded to the same folder, wither they are in the same image gallery.....i´m use mysql to have to numbers of the pics sorted.......anyway!!!


Say that there where images like 331.jpg 332.jpg 333.jpg in the folder, i want to upload the new pic to this folder and rename to to the highest number of them all....exzedra exzedra...

im this case it would be renamed to 334.jpg


Can anyone help me!!!

Reply With Quote
  #2  
Old October 1st, 2002, 10:49 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
so for each file thats uploaded you want to increment the file name?

Because your using a database to store details about it. It would be easier if you store the name of the file in a database,

So we have the database with the name, 334.gif..etc 334.gif is the last file added

you firstly need to get the last number in this case 334

$query = mysql_query("SELECT file_name FROM images ORDER BY id DESC")

this should give you the last entry added

then you have something like this

$count = mysql_result($query, 0, 0);

$count = explode(".", $count);

so now $count[0] holds our number

then we increment it

$number = $count[0] + 1, so now you have the next number, in which y

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > rename the imagefile to the highest avilable number in DIR


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway