473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Storing Images in SQL Server - ASP storage and retrieve

I need some help, because I am utterly confused with how to do this. I have
2 things that I need to figure out, and could use some sample code or just
some general direction:

1) I need to build an admin page that allows me to browse to the file that I
want stored in SQL Server 2000 in an image field, have it uploaded to the
server, and then stored in the db. I see this done all the time, so I don't
think this part is too hard, but I'm not sure how to get the image into the
db.

2) I want to display the image within a web page, so I would want to pull
the image out of the db, place it on my web server in a certain location,
and then reference the file in the HTML. How do I do that?

Thanks in advance for any help you can provide.

--Mike
Jul 19 '05 #1
9 4836
1) Actually it's not a good idea. Upload the image to the server and store
the Name/Location in the DB. look at www.darkfalz.com/1043 for a simple
upload script.

2) Much simplier if you have the image on the server.... :}

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Michael Walton" <mw*****@NOthomasassociatesSPAM.cc> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
I need some help, because I am utterly confused with how to do this. I have 2 things that I need to figure out, and could use some sample code or just
some general direction:

1) I need to build an admin page that allows me to browse to the file that I want stored in SQL Server 2000 in an image field, have it uploaded to the
server, and then stored in the db. I see this done all the time, so I don't think this part is too hard, but I'm not sure how to get the image into the db.

2) I want to display the image within a web page, so I would want to pull
the image out of the db, place it on my web server in a certain location,
and then reference the file in the HTML. How do I do that?

Thanks in advance for any help you can provide.

--Mike

Jul 19 '05 #2
Why do you want to store the image in the database? This article really
helped me decide which way to go on this, and I'm glad I didn't use the
database for file storage after I've seen the headaches it's caused some of
my colleagues.

http://www.aspfaq.com/show.asp?id=2149

There are also links to knowledge base articles that show a few different
methods, with code samples, if it's really what you want to do. But I
highly recommend you reconsider.
"Michael Walton" <mw*****@NOthomasassociatesSPAM.cc> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
I need some help, because I am utterly confused with how to do this. I have 2 things that I need to figure out, and could use some sample code or just
some general direction:

1) I need to build an admin page that allows me to browse to the file that I want stored in SQL Server 2000 in an image field, have it uploaded to the
server, and then stored in the db. I see this done all the time, so I don't think this part is too hard, but I'm not sure how to get the image into the db.

2) I want to display the image within a web page, so I would want to pull
the image out of the db, place it on my web server in a certain location,
and then reference the file in the HTML. How do I do that?

Thanks in advance for any help you can provide.

--Mike

Jul 19 '05 #3
> 2) I want to display the image within a web page, so I would want to pull
the image out of the db, place it on my web server in a certain location,
and then reference the file in the HTML.


Read that sentence a couple of times, and think about how efficient that is
compared to <img src=/images/uploadedImage.jpg>
Jul 19 '05 #4
I normally just store images on the directory structure, but I am having a
real hard maintaining this in the environment that I am in. We have many,
many authors and they keep moving images, deleting images, renaming images,
and I end up with broken images, so I'd rather take care of it through the
ASP code, so they can't screw it up. I will check the link, though.

"Foo Man Chew" <fo*@man.chew> wrote in message
news:OT**************@TK2MSFTNGP11.phx.gbl...
Why do you want to store the image in the database? This article really
helped me decide which way to go on this, and I'm glad I didn't use the
database for file storage after I've seen the headaches it's caused some of my colleagues.

http://www.aspfaq.com/show.asp?id=2149

There are also links to knowledge base articles that show a few different
methods, with code samples, if it's really what you want to do. But I
highly recommend you reconsider.
"Michael Walton" <mw*****@NOthomasassociatesSPAM.cc> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
I need some help, because I am utterly confused with how to do this. I have
2 things that I need to figure out, and could use some sample code or just some general direction:

1) I need to build an admin page that allows me to browse to the file that I
want stored in SQL Server 2000 in an image field, have it uploaded to

the server, and then stored in the db. I see this done all the time, so I

don't
think this part is too hard, but I'm not sure how to get the image into

the
db.

2) I want to display the image within a web page, so I would want to pull the image out of the db, place it on my web server in a certain location, and then reference the file in the HTML. How do I do that?

Thanks in advance for any help you can provide.

--Mike


Jul 19 '05 #5
Simpler isn't always best, unfortunately. Like I told Foo Man Chew, I have
control issues with the images being on the directory structure, so I need
to look into db methods. Thanks for the opinion, though (and I agree with
it).
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uA**************@TK2MSFTNGP12.phx.gbl...
1) Actually it's not a good idea. Upload the image to the server and store
the Name/Location in the DB. look at www.darkfalz.com/1043 for a simple
upload script.

2) Much simplier if you have the image on the server.... :}

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Michael Walton" <mw*****@NOthomasassociatesSPAM.cc> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
I need some help, because I am utterly confused with how to do this. I have
2 things that I need to figure out, and could use some sample code or just some general direction:

1) I need to build an admin page that allows me to browse to the file that I
want stored in SQL Server 2000 in an image field, have it uploaded to

the server, and then stored in the db. I see this done all the time, so I

don't
think this part is too hard, but I'm not sure how to get the image into

the
db.

2) I want to display the image within a web page, so I would want to pull the image out of the db, place it on my web server in a certain location, and then reference the file in the HTML. How do I do that?

Thanks in advance for any help you can provide.

--Mike


Jul 19 '05 #6
Right - I totally understand. However, when that image isn't there, because
dumb-idiot content developer has moved it or deleted it, how efficient is
the empty image with the red x in it?? I totally understand what I am
asking, and unless you have a better way to control the images on the
server, I have to use the DB to do it. This will take the control away from
the content developer and put it back into my hands. Trust me....the way
you are telling to do it is the way I've done it for 10 years, but its not
working in this environment, because of the morons I'm dealing with.

--Mike

"Foo Man Chew" <fo*@man.chew> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl...
2) I want to display the image within a web page, so I would want to pull the image out of the db, place it on my web server in a certain location, and then reference the file in the HTML.
Read that sentence a couple of times, and think about how efficient that

is compared to <img src=/images/uploadedImage.jpg>

Jul 19 '05 #7
Thanks, Foo. That link had some good information in it, as well as links
with great examples. Exactly what I was looking for.

I also appreciate the opinions that are out there....if I could do it that
way, I would continue to do so, but until they start hiring intelligent
people (or intelligent people start breeding), I'm stuck with this.

--Mike

"Foo Man Chew" <fo*@man.chew> wrote in message
news:OT**************@TK2MSFTNGP11.phx.gbl...
Why do you want to store the image in the database? This article really
helped me decide which way to go on this, and I'm glad I didn't use the
database for file storage after I've seen the headaches it's caused some of my colleagues.

http://www.aspfaq.com/show.asp?id=2149

There are also links to knowledge base articles that show a few different
methods, with code samples, if it's really what you want to do. But I
highly recommend you reconsider.
"Michael Walton" <mw*****@NOthomasassociatesSPAM.cc> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
I need some help, because I am utterly confused with how to do this. I have
2 things that I need to figure out, and could use some sample code or just some general direction:

1) I need to build an admin page that allows me to browse to the file that I
want stored in SQL Server 2000 in an image field, have it uploaded to

the server, and then stored in the db. I see this done all the time, so I

don't
think this part is too hard, but I'm not sure how to get the image into

the
db.

2) I want to display the image within a web page, so I would want to pull the image out of the db, place it on my web server in a certain location, and then reference the file in the HTML. How do I do that?

Thanks in advance for any help you can provide.

--Mike


Jul 19 '05 #8
So your content guy has his web server, and you have your DB server
... right? That's gotta suck ... can he create a virtual folder for
the website ... a folder that is on your server?

On Tue, 30 Dec 2003 12:20:18 -0500, "Michael Walton"
<mw*****@NOthomasassociatesSPAM.cc> wrote:
Right - I totally understand. However, when that image isn't there, because
dumb-idiot content developer has moved it or deleted it, how efficient is
the empty image with the red x in it?? I totally understand what I am
asking, and unless you have a better way to control the images on the
server, I have to use the DB to do it. This will take the control away from
the content developer and put it back into my hands. Trust me....the way
you are telling to do it is the way I've done it for 10 years, but its not
working in this environment, because of the morons I'm dealing with.

--Mike

"Foo Man Chew" <fo*@man.chew> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl...
> 2) I want to display the image within a web page, so I would want topull > the image out of the db, place it on my web server in a certainlocation, > and then reference the file in the HTML.


Read that sentence a couple of times, and think about how efficient that

is
compared to <img src=/images/uploadedImage.jpg>



Jul 19 '05 #9

"Michael Walton" <mw*****@NOthomasassociatesSPAM.cc> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl...
Simpler isn't always best, unfortunately. Like I told Foo Man Chew, I have control issues with the images being on the directory structure, so I need
to look into db methods. Thanks for the opinion, though (and I agree with
it).

<snip>

Why not solve your control issues, but storing the final images on the web
server, where the authors cannot touch them? They can have their own working
copy and submit the final to be included?

BV.
Jul 19 '05 #10

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

Similar topics

7
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...
3
by: Dave Smithz | last post by:
Hi There, Being quite new to MS-SQL I would like to ask if there is a general opinion of what approach should be taken to storing things like external documents and images in databases. ...
6
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...
3
by: bissatch | last post by:
Hi, I am wanting to learn how to store images in a postgreSQL database. I have got as far as uploading the file using a file/browse field on an html form and have been able to catch the file...
3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
1
by: Al | last post by:
Hi, I need to store literally thousands if images and scanned document in the Database. I would like to know what is the most efficient algorithm both in terms of speed and storage for saving images...
9
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!!!...
2
by: Frankie | last post by:
Using SQL Server 2005 and .NET 2.0; I'm creating a Windows Forms application that will need to display photos of people, along with a bunch of information about each person. In a Web...
4
by: lorirobn | last post by:
Hi, I need to add photos to my database. Back End is on MS SQL Server (I believe 2000), and Front End is on MS Access. I have read about storing the photos as BLOBS, but I am not sure how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.