473,791 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing images in folder or database?

Hello,

I am working on an ASP.NET based website project. Without going into
much detail; One of the function on this website will be the
possibility to upload images via a ASP.NET form to the webserver. These
images can then be shown on to webpages throughout the site.

What would be the best way of storing these images? Just by saving them
in a folder on de webserver or in a database?

What are the advantages and disadvantages of both working methods?

Thanks.

Nov 23 '05 #1
4 4645
I have faced this problem twice and each time I elected to put them in the
file system and then have some table that tracks filenames and associates to
an object in the database. Obviously you lose referential integrity but it
is possible to write a little program that checks that a row in the table
exists for each file name and a filename exists for each row in the table.

On one project we have 12GB of files and the database is only 500meg in
size. The management of the DB would have been more difficult if all of the
files were stored in it.

If you have a lot of files it is important to choose a good naming scheme
and directory structure. Our scripts automatically create a directory per
year per month per day of month. ie Files\2005\04\3 1\ In that way no one
directory becomes too large.

Backing up the data is also a breaze - xcopy.

You have to structure the transaction during the upload. If you start a
transaction, wait for the file to upload, add it to the database, add it to
the file system and then commit the transaction then you will have some long
running locks. Be careful that if the file does not upload correctly then
everything is clean up as expected.

There is some more code to write to manage the files and directories and the
database but it is a solution that works well.

I hope this helps. Feel free to contact me if you want more information (or
even code)

Dave A

"IkBenHet" <ik********@hot mail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
Hello,

I am working on an ASP.NET based website project. Without going into
much detail; One of the function on this website will be the
possibility to upload images via a ASP.NET form to the webserver. These
images can then be shown on to webpages throughout the site.

What would be the best way of storing these images? Just by saving them
in a folder on de webserver or in a database?

What are the advantages and disadvantages of both working methods?

Thanks.

Nov 23 '05 #2
I have faced this problem twice and each time I elected to put them in the
file system and then have some table that tracks filenames and associates to
an object in the database. Obviously you lose referential integrity but it
is possible to write a little program that checks that a row in the table
exists for each file name and a filename exists for each row in the table.

On one project we have 12GB of files and the database is only 500meg in
size. The management of the DB would have been more difficult if all of the
files were stored in it.

If you have a lot of files it is important to choose a good naming scheme
and directory structure. Our scripts automatically create a directory per
year per month per day of month. ie Files\2005\04\3 1\ In that way no one
directory becomes too large.

Backing up the data is also a breaze - xcopy.

You have to structure the transaction during the upload. If you start a
transaction, wait for the file to upload, add it to the database, add it to
the file system and then commit the transaction then you will have some long
running locks. Be careful that if the file does not upload correctly then
everything is clean up as expected.

There is some more code to write to manage the files and directories and the
database but it is a solution that works well.

I hope this helps. Feel free to contact me if you want more information (or
even code)

Dave A

"IkBenHet" <ik********@hot mail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
Hello,

I am working on an ASP.NET based website project. Without going into
much detail; One of the function on this website will be the
possibility to upload images via a ASP.NET form to the webserver. These
images can then be shown on to webpages throughout the site.

What would be the best way of storing these images? Just by saving them
in a folder on de webserver or in a database?

What are the advantages and disadvantages of both working methods?

Thanks.

Nov 23 '05 #3
Hello Dave,

Thanks for your clear answer! So, basically it is integrity that you
can lose if the script is not structured in a good way. Of course some
reference code is welcome. Was is all done in ASP.NET? You can sent it
to my e-mail adres.

Thanks.

Nov 23 '05 #4
Hello Dave,

Thanks for your clear answer! So, basically it is integrity that you
can lose if the script is not structured in a good way. Of course some
reference code is welcome. Was is all done in ASP.NET? You can sent it
to my e-mail adres.

Thanks.

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3492
by: Benoit St-Jean | last post by:
I am looking at options/ways to store 12 million gif/jpg images in a database. Either we store a link to the file or we store the image itself in the database. Images will range from 4k to 35k in size and there will be 12 millions of them (at the beginning)... I expect a 8% growth every year. We will also have to perform some cleanup jobs to delete images that are not longer referenced by the master table. We'll also have to...
6
3048
by: bissatch | last post by:
Hi, I am currently writing a news admin system. I would like to add the ability to add images to each article. What I have always done in the past is uploaded (using a form) the image to a folder on the server and then in the database table that I INSERT the news article, I'll store the path of the uploaded image. To me this seems a bad idea as if the image paths were changed on the
4
2730
by: Rednelle | last post by:
Greetings all, As a newbie, using Access 2000, I would appreciate advice on the best way to include pictures. I have developed a 'Home Inventory' database which can include jpeg thumbnails of my items and I can review things at anytime - on the desktop where I created all this - no problem so far. I networked the mdb file (only) across to my laptop and found the pictures don't show. So I guess my database table is only storing links to
0
324
by: IkBenHet | last post by:
Hello, I am working on an ASP.NET based website project. Without going into much detail; One of the function on this website will be the possibility to upload images via a ASP.NET form to the webserver. These images can then be shown on to webpages throughout the site. What would be the best way of storing these images? Just by saving them in a folder on de webserver or in a database?
9
2374
by: Adam J Knight | last post by:
Hi all, Just wondering whats everyones prefered method of storing images ? 1) File System 2) Database (SqlServer) (Seems to be easier, but has a performance hit) Appreciate some insight!!! Cheers,
9
3843
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
1
2505
by: leen | last post by:
helo..i'm az...from kuala lumpur...i would like to ask a question about access...i have doing a project based on access...i have done it successfully but now the problem is size of the file...the limit for access is only 2gb...but the file that i have to put in that database is about 5gb..the type of file that i have to store is images(bitmap) about 38000 images...before this,i store all the images to access...but cannot store all the...
2
1163
by: Spondishy | last post by:
Hi, I've taken over a publishing application that stores images in a sql server db. The architecture is basically many load balanced web servers connecting to the db. When an image is pulled from the db it uses an aspx page similar to this <img src="image.aspx?imgid=1" /> I realise there are trade offs between performance security etc, but I think this is going to be a bottleneck in the app going forward. Is there anything I can do to...
0
1393
by: RussCRM | last post by:
I want to use a command button, say "cmdDisplayImage" to display/ transfer a captured image from the ezVidCap1 control to an image or OLE box on the same form such as "PhotoPreview" (not sure which one is possible/best...perhaps someone can help me...I'm new at this.) I really don't want to "save" it first. Then, I want another command button such as "cmdSaveImage" to save the file to a folder (such as \\Server\Database\Images when...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.