By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Storing Images in SQL Server - ASP storage and retrieve

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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 discussion thread is closed

Replies have been disabled for this discussion.