Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2007
    Posts
    16

    Unanswered: File Uploading conventions - renaming vs keeping original filename - opinions?

    Dear Forum

    The CMS I'm building has a section where the user can upload images. In the front end an image appears within a project section. Each project can have multiple images.

    I'm all set on the database and the uploading part. What I'm debating still is whether I should
    1) keep the original filename on the server, or
    2) rename the filename to something like : "img_categoryID_imageID.jpg"
    3) keep the original filename but append the time/date to avoid accidental overwritings by the user.

    I wanted to hear a few opinions on this subject. I'm not quite sure which way to go and wanted to hear if there are obvious reasons to go with either one.

    I could instruct the admins to follow certain naming convention rules before uploading the files in which case I could go with 1) or 3)... I'm tending to go with that but I wanted to hear from people with real world experience since this is my first project of this kind.

    Any insight appreciated.

    Thank you

    stephank

  2. #2
    Join Date
    Aug 2007
    Posts
    3
    If you give them unique names then that means your users can upload documents/files with the same name.

  3. #3
    Join Date
    Jan 2005
    Posts
    362
    I had a simiral problem with asp.My solution were to give this name
    Code:
    user_filename.doc
    and to insert at db this name so we can find it then, so something like you 2 choice.
    If you find a way to find filenames with no use of database, it will be better.
    DImis

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by stephank
    2) rename the filename to something like : "img_categoryID_imageID.jpg"
    Is the "img_" really necessary when naming a jpg?
    I think the file extension pretty much explains what the file is!!
    George
    Home | Blog

  5. #5
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    Quick note before I log off (i've only read the post briefly).

    ALWAYS rename the filenames of the images when they are uploaded. It's not safe to let the user name their own files
    by all means let them have a database field to input the "name" of their photo, but certainly don't let them utilise their own naming system.
    Injecting javascript anyone???

    note : I'll come back to this post later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •