473,804 Members | 3,672 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 4646
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
3493
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
2376
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
3848
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
1165
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
1394
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
10319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6845
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
5508
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
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
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
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.