upload files into sql server db

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    upload files into sql server db

    My users need to store and retrieve various files (pdfs, docs, jpegs
    etc). I am developing an asp.net 2.0 web application, with SQL server
    backend. I've been looking at my best options and am quite new to web
    development. I am thinking about this process:

    1) Upload the doc
    2) zip it
    3) Store in the db / on the server

    Can anyone give me some advice and pros and cons on the following:

    * Storing the file in the database vs storing it on the server
    * Zipping the file prior to storing it

    I was looking into how to compress files and found that using
    GZipStream seemed to make some files larger, so I wonder how much point
    there is in that! But I am hoping to slow down the growth of my
    database if possible as there are potentially a lot of files that will
    be uploaded.

    Thanks very much

  • Darren Kopp

    #2
    Re: upload files into sql server db

    cons to storing in database - your database file is going to get very
    large very quickly. If you are concerned about the size of your
    database file, store the items on the system, not as BLOB types in Sql
    Server.

    Here's another question - are your users going to be downloading the
    zip and then opening it? When you think about it, PDF's and Images
    already do compression, so zipping won't actually do to much to them.
    Documents will benefit from zipping, though if you are only zipping 1
    document, then storing it, that may be over kill. For groups of PDF's,
    images, and documents, you may see a benefit from zipping. Also, you
    would only want to zip together groups of items that are requirements
    of each other, items that are related in some way. You don't want to
    just zip together lots of random files to conserve space.

    I would do the following -

    1 - Upload to server (1 or multiple items)
    2 - If multiple items, zip and save to server. if single item, save to
    server
    3 - save location (relative or absolute) to database with details about
    what item is (like given name, etc)

    then when you access the file, you just load the location stored in the
    DB. Also, by just having text in the DB, with your database
    maintenance plan, when you compress the DB file, it will compress much
    better than if you had binary data inside of it.

    HTH,
    Darren Kopp


    Comment

    • Andy

      #3
      Re: upload files into sql server db

      Thanks for your reply Darren, I think I'll do as you suggest - keep on
      the server and zip if in a group.

      Comment

      Working...