if the file name isn't important, I upload the file, store the file type (and other stats like file size and height, width if it's an image) in a table. Then I grab the id number from that entry and rename the file to the id number (primary key) and file type. I then have other fields in the table that will tell me who uploaded it, what section it should go to, stuff like that. Nate <http://www.vtrenz.com/>
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Riquez Sent: Tuesday, May 03, 2005 12:45 PM To: [email protected] Subject: Re: [php-list] UPloading files - to avoid overwriting On 3 May 2005, at 15:08, Marian Briones wrote: > Hi - > > I have a tool where executive committees can upload their meeting > minutes to the site and have them listed. What is the best way to: > > 1) Prevent accidental overwriting with same file names? (I have > thought adding something to the copied file name)? > > 2) Only allow the person who uploaded the file to change the file, > i.e. if they accidently uploaded the wrong file to be able to upload a > new one. > > I think the answer is fairly straightforward, but I can't seem to > grasp it yet. Lot's of suggestions already for this. I would do it like this... * When a USER account is created, create a folder for them on the server. * When they upload a doc it goes in their folder. * Rename the uploaded doc to DATE_filename.ext (DATE as YYYYmmdd) * If they upload more than 1 per day then append the filename : DATE_filename_2.ext * next to each file in the list you can have a button (delete) & (replace) that only show if they are logged in. Pretty easy to convert the filenames into a nice format on screen, & make the filename clickable to read/download. (replace) 2005 / 04 / 28 Finance Meeting [pdf] (delete) With the date prefix, you can restrict the listed docs to last 30 days or something so it doesn't become a huge list. Of course you can also provide a "show all" feature. Riquez [Non-text portions of this message have been removed] Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . [Non-text portions of this message have been removed] Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
