TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-10-2008, 03:53 AM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default uploading documents and pdfs

if i have a webpage with the ability for hundreds of people to login and each upload their own specified document,pdf etc. then be able to see what they uploaded on their profile. how will or can this be done? if the files are uploaded to a directory how can i tell php to know which file belongs to which person by just renaming a file? what if files colide ?

the other thing i was thinking of having these files sent to mysql database and if i did do that what are the chances of the database failing?

and how would i design the table for this?


maybe something like this??

Code:
table: upload files

columns:

id
file upload1
file upload 2

etc....
but then what if they uploaded more than one file , maybe 100ths of them. how will this table be design to hold such data for each individual person?

im confused..


thanks for any help :)
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 06-10-2008, 04:13 AM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Well, it sounds like you have some kind of user authentication in place, so everybody should have a unique username, correcto? If so, then use their username as the naming convention for their files.

username-originalfilename.pdf

If you want to go a step further and see if that particular user has already uploaded a file of the same name and type, use file_exists() and decide at that point if you want to overwrite the file or append something additional to the name.
-m
delayedinsanity is offline  
Reply With Quote
Old 06-10-2008, 01:08 PM   #3 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Have your file structre like
ID
User_ID
File_Name

That way they can upload as many files as they need and they are linked. You could then either left join that table on users.id = files.User_ID or seperately query everything where the files user_id is equal to the users ID.

Also, dont store files in the database like that. It will slow everything down and will be in no way shape or form more efficient.
__________________

Village Idiot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:21 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design