c# - How to save uploaded pics in database? -


My new C #. In the 3.5 ASP website, the user is likely to upload a photo.

What is the best solution to save this picture? Should I save it to a folder on my server and save the path to the database, or should I save the image in the database?

PRO files:

  1. To serve a file on the feedback stream There is a simple call to just set up ContentType properly, call it, and you've done it.
  2. Its more demonstrative (though it is often exaggerated, good use of blobs or SQLServer filestreams is pretty good, but still it is lost compared to file operations). Pro DB:

    1. Compatibility is easy, you can not be in a situation where the file structure and database do not match.
    2. If you go to a web-form solution with more than one webserver (above a certain amount of success), file-based solutions are difficult.
    3. Data transfer modifications are usually easy for you to go anywhere, moving DB data anywhere, so once you have solved it you can solve it for images too. Have done
    4. The manipulation code is easy to write.
    5. It is easy to report on the entire collection of images.

Comments