PDA

View Full Version : How can I load an image by asp


Ahmult
10-17-2005, 10:17 AM
Is it hard to do it? Do we have to use database or something else to do?

Freon22
10-17-2005, 06:39 PM
You can use just standard html if you want. I put my gif, and jpg files in a folder called images. You don't have to use the width, height, and border if you don't want to.

<img src="images/***.jpg" alt="" width="354" height="132" border="0">

Also if you want to have a different image for different users you can do something like this. You can even make it so that its random pictures if you want. Last you can encase the html in vbscript so you can display or not.

<%
Dim pit
pit = "***.jpg"
%>
<img src="images/<%=pit%>" alt="" width="354" height="132" border="0">

Bullschmidt
10-17-2005, 11:01 PM
And here is a pure ASP (i.e. no components) resource for letting the user upload a file which is something that was unfortunately not built into ASP:

ASP File Upload Using VBScript by John R. Lewis - 7/10/2000
http://aspzone.com/articles/160.aspx

The above free code has worked well for me and you can copy and paste the code sample which is white on gray (what were they thinking?) or just highlight it and it becomes black on white.

Ahmult
10-18-2005, 02:16 AM
thanks. If I want to let user upload some pics, can my web show it orderly. Like some image gallery community(deviantart or photobucket).

Bullschmidt
10-18-2005, 02:18 PM
When uploading a pic I usually also create an record with info about it in the database including the filename and other info such as RepNo, ProductIDNum, ProductDescr, etc.