PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

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:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old November 12th, 2003, 02:52 AM
maheshkrp maheshkrp is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 maheshkrp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Multiple files upload using PHP

Iam a new bie....

I have to upload three files like one bye one...it's working fine but the problem is when iam uploding second time (i.e if i upload the same file i mean some other user will upload his file with the same name...the first uploaded file is overwriting..i don't want to
happen this...) i want the two files in my database...what is the solution for this...

experts can any one help me .....

Rgds,
mahesh

Reply With Quote
  #2  
Old November 12th, 2003, 09:10 AM
manoloweb manoloweb is offline
Moderated
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Monterrey MX
Posts: 49 manoloweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I use to do this:

I change the name of the uploaded file when saving. The new name is generated using the upload database record ID, so it's unique.

Example:

File Name: manolo.xls

Insert query:
insert into uploaded (id,usr,name,dateuploaded) values (NULL, 213, 'manolo.xls', now())

Then I recall the last insert ID:
$newname=mysql_insert_id().".file";

This will generate a new name like this: 158.file

That's the file name you save.

And when you want to deliver the file as a download, just retrieve the actual name from the DB.

;-)

Reply With Quote
  #3  
Old November 13th, 2003, 05:02 AM
maheshkrp maheshkrp is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 maheshkrp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you for your reply...

Reply With Quote
  #4  
Old November 13th, 2003, 04:53 PM
mwichmann4 mwichmann4 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 80 mwichmann4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 45 sec
Reputation Power: 5
Take a look at my multiple php upload tutorial as well. I might help you out on the concepts of doing this.

http://www.devarticles.com/art/1/671
__________________
Nothing is Everything

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Multiple files upload using PHP


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 3 hosted by Hostway