Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Nathon Jones #1
Images in Databases - what is the best way?
Hi,
Really just looking at some advice here. What is the best, most efficient,
way to store images?
The way I've worked so far is to store images in a directory on a server,
and to use a database to store the image file name:
ProductID - 1
Name - T-shirt
Image - tshirt.jpg
I then use a little bit of code to display this on a site:
<img src="imagefolder/<%=(rsRecordset.Fields.Item("Image").Value)%>">
Is this the best way to do this?
Is there any benefit in storing the image file within the database?
Will this not massively increase the database size, thus increasing the load
on it when users are browsing a site?
Also, I am using ASPUpload to allow clients to upload images directly into
their web site image folder.
They are then having to use an INSERT form to insert the image name
(tshirt.jpg) into one of the DB table fields.
I am trying to reduce the number of steps required by a user in order to
upload an image.
Thanks for any advice offered.
Regards
nath.
Nathon Jones Guest
-
scrolling images/slider NOT motion images PLEASE REPLY someone
i want scrolling images...... like scroll bar with text but scroll bar with images...i dont it as in motion pictures....IF no one knows wot i mean... -
Displaying Images from Databases on ASP Page
have been searching for two complete days now on how to display images from a database on the webpage using ASP. I found a script giving some... -
Federated Databases, joins across databases etc
Greetings, I want to do a join between 2 tables on 2 different db2 databases on the same server. I assume that I have to use federated databases. I... -
[PHP] images in databases & Flash via PHP
Saving Images in MySQL http://www.weberdev.com/ViewArticle.php3?ArticleID=3 Sincerely berber Visit http://www.weberdev.com/ Today!!! To... -
images in databases & Flash via PHP
I was wondering - are there any good tutorials/examples of serving & updating images from a mySQL database via PHP? I assume this is possible, but... -
Joe Makowiec #2
Re: Images in Databases - what is the best way?
On 21 Apr 2005 in macromedia.dreamweaver.appdev, Nathon Jones wrote:
Yup.> Is this the best way to do this?
Not that I've ever seen.> Is there any benefit in storing the image file within the database?
If you're using an Access database, it's bloated already anyway...> Will this not massively increase the database size, thus increasing
> the load on it when users are browsing a site?
Just set up the form with both the image and description fields, and> Also, I am using ASPUpload to allow clients to upload images
> directly into their web site image folder.
> They are then having to use an INSERT form to insert the image name
> (tshirt.jpg) into one of the DB table fields.
> I am trying to reduce the number of steps required by a user in
> order to upload an image.
process them at the same time.
<form action="processmyfile.asp" method="post" enctype="multipart/form-data" name="form1">
<p><input type="file" name="file"></p>
<p><input type="text" name="description"></p>
</form>
--
Joe Makowiec
[url]http://makowiec.net/[/url]
Email: [url]http://makowiec.net/email.php[/url]
Joe Makowiec Guest
-
Nathon Jones #3
Re: Images in Databases - what is the best way?
Thanks Joe.
That is very re-assuring! :)
With regard the ASPUpload you wrote:
Just set up the form with both the image and description fields, and process
them at the same time.
<form action="processmyfile.asp" method="post" enctype="multipart/form-data"
name="form1">
<p><input type="file" name="file"></p>
<p><input type="text" name="description"></p>
</form>
But when I upload the image from, lets say, my Desktop (like a client would
probably do), the ASPUpload text box has:
C:\Documents and Settings\User\Local Settings\Desktop\tshirt.jpg (not quite
that, but you get my drift!)
How do I get it to strip everything, but the file name, out?
Also, why is the image file field type="file"...surely it should just be
text because it should just contain "tshirt.jpg"?
The very nice people at UltraSuite are looking into this for me at the
moment, so there may well be an extension that helps us novices out soon.
Thanks for your advice...much appreciated.
Nath.
"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns963F5A5D5CAD2makowiecatnycapdotrE@216.104. 212.96...> On 21 Apr 2005 in macromedia.dreamweaver.appdev, Nathon Jones wrote:
>>>> Is this the best way to do this?
> Yup.
>>>> Is there any benefit in storing the image file within the database?
> Not that I've ever seen.
>>>> Will this not massively increase the database size, thus increasing
>> the load on it when users are browsing a site?
> If you're using an Access database, it's bloated already anyway...
>>>> Also, I am using ASPUpload to allow clients to upload images
>> directly into their web site image folder.
>> They are then having to use an INSERT form to insert the image name
>> (tshirt.jpg) into one of the DB table fields.
>> I am trying to reduce the number of steps required by a user in
>> order to upload an image.
> Just set up the form with both the image and description fields, and
> process them at the same time.
>
> <form action="processmyfile.asp" method="post"
> enctype="multipart/form-data" name="form1">
> <p><input type="file" name="file"></p>
> <p><input type="text" name="description"></p>
> </form>
>
> --
> Joe Makowiec
> [url]http://makowiec.net/[/url]
> Email: [url]http://makowiec.net/email.php[/url]
Nathon Jones Guest
-
Joe Makowiec #4
Re: Images in Databases - what is the best way?
On Thu 21 Apr 2005 09:10:42a, Nathon Jones wrote in
macromedia.dreamweaver.appdev:
There are several parts to the process:> But when I upload the image from, lets say, my Desktop (like a client
> would probably do), the ASPUpload text box has:
> C:\Documents and Settings\User\Local Settings\Desktop\tshirt.jpg (not
> quite that, but you get my drift!)
>
> How do I get it to strip everything, but the file name, out?
>
> Also, why is the image file field type="file"...surely it should just
> be text because it should just contain "tshirt.jpg"?
- find the file on the client machine
- upload the file to the host
- save the file on the host
- save the (uploaded) filename in the database on the host
- save the file description in the database on the host
I'm not familiar with ASPUpload, but its function is going to be, I assume,
to take care of the second and third of those items. You, the web
designer, have to do the others. The first you do by way of having an
<input type="file"...> in your upload form. The last two you do in the
script which processes the input from the form.
Note: for security reasons, you don't necessarily want to use the name of
the file which was uploaded as the name of the file you save on the server.
Joe Makowiec Guest
-
Joe Makowiec #5
Re: Images in Databases - what is the best way?
On Thu 21 Apr 2005 05:07:52p, Joe Makowiec wrote in
macromedia.dreamweaver.appdev:
Added note: this also has the advantage of avoiding filename collisions.> Note: for security reasons, you don't necessarily want to use the name
> of the file which was uploaded as the name of the file you save on the
> server.
Say you uploaded a file called bottle.jpg', because it was of a bottle.
Because this site is devoted to collectors of bottles, I, too want to
upload a picture from my collection. Human ingenuity being what it is, my
file is also called, oddly enough, 'bottle.jpg'. This creates problems
when you go to save the file.
If you have the upload routine create a filename based on, say, the date
and time that the file was uploaded, odds are very good that you'll never
have a filename collision. You could also save the original filename in
the record, so that the record could be searced by original filename if you
wanted.
Joe Makowiec Guest
-
Manuel Socarras #6
Re: Images in Databases - what is the best way?
Nathon Jones wrote:
in the page processmyfile.asp you can't use the Request.Form collection> Thanks Joe.
> That is very re-assuring! :)
>
> With regard the ASPUpload you wrote:
>
> Just set up the form with both the image and description fields, and process
> them at the same time.
>
> <form action="processmyfile.asp" method="post" enctype="multipart/form-data"
> name="form1">
> <p><input type="file" name="file"></p>
> <p><input type="text" name="description"></p>
> </form>
>
> But when I upload the image from, lets say, my Desktop (like a client would
> probably do), the ASPUpload text box has:
> C:\Documents and Settings\User\Local Settings\Desktop\tshirt.jpg (not quite
> that, but you get my drift!)
>
> How do I get it to strip everything, but the file name, out?
to access elements in the form so, you must use 2 collections provided
by ASPUpload. to recover the file name:
Upload.Files("file").FileName
or the entire path:
Upload.Files("file").Path
note that "file" is the name you assigned to the <INPUT type="file" field
i'm not sure now but i'd swear ASPUpload can generate unique file names,
check the manual
type="file" is a special field that shows, besides the text box, the> Also, why is the image file field type="file"...surely it should just be
> text because it should just contain "tshirt.jpg"?
browse button to allow the user to select the file without having to
type the entire path
Manuel Socarras Guest



Reply With Quote

