ASP Free Forums
> Programming
> ASP Development
Shadow Uploader - display uploaded image after uploading it
Discuss Shadow Uploader - display uploaded image after uploading it in the ASP Development forum on ASP Free. Shadow Uploader - display uploaded image after uploading it ASP Development forum discussing ASP related topics including coding practices, ASP tips, and more. Active Server Pages (ASP) enables you to empower your HTML pages dynamically with robust scripting options.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses . Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.
Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.
Download to Enter | Contest Rules
Learn More!
Tutorials | Forums
ASP Free Forums Sponsor:
June 6th, 2006, 08:31 AM
I-Team User
Join Date: May 2006
Location: Florida
Last edited by Shadow Wizard : June 13th, 2006 at 08:49 AM .
June 6th, 2006, 08:48 AM
Moderator From Beyond
Join Date: Sep 2004
Location: Israel
yes, assuming you're still using the code you attached have such code:
Code:
<img src="Uploads/<%=objUpload("name") & Right(objUpload.File(0).FileName, 4)%>" />
June 6th, 2006, 09:32 AM
I-Team User
Join Date: May 2006
Location: Florida
Quote:
Originally Posted by Shadow Wizard
yes, assuming you're still using the code you attached have such code:
Code:
<img src="Uploads/<%=objUpload("name") & Right(objUpload.File(0).FileName, 4)%>" />
Ok i get this error
Microsoft VBScript runtime error '800a000d'
Type mismatch
/auditquery.asp, line 95
Line 95 is your script.
BUT after i upload a picture my form loads
i got it to work another way but i like your way better, so do you have any ideas on how to fix it?
here is my code.
Code:
<img src="\UPloads\<%Response.Write objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
Ok and now i changed my upload directory to
Code:
Call objUpload.File(x).SaveToDisk(Server.MapPath("\audit_images"), objUpload("name"))
and that works fine but now i can't get the pictures to display, how do i get it to go to that directory.
June 6th, 2006, 11:58 PM
Moderator From Beyond
Join Date: Sep 2004
Location: Israel
change this:
Code:
<img src="\UPloads\<%Response.Write objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
to this:
Code:
<img src="/audit_images /<%Response.Write objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
June 7th, 2006, 07:04 AM
I-Team User
Join Date: May 2006
Location: Florida
My Audit_images folder is out side my web root folder, not sure if i can even do that.
Quote:
Originally Posted by Shadow Wizard
change this:
Code:
<img src="\UPloads\<%Response.Write objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
to this:
Code:
<img src="/audit_images /<%Response.Write objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
June 7th, 2006, 07:25 AM
Moderator From Beyond
Join Date: Sep 2004
Location: Israel
Quote:
Originally Posted by JustXtreme
My Audit_images folder is out side my web root folder, not sure if i can even do that.
no it's not. if it were outside of the website, you couldn't have such code working:
Code:
Call objUpload.File(x).SaveToDisk(Server.MapPath("\audit_images") , objUpload("name"))
the code in bold is mapping folder that reside in the website to actual disk path.
June 7th, 2006, 07:29 AM
I-Team User
Join Date: May 2006
Location: Florida
My audits folder is here Z:\audit_images
and my site is here Z:\webs\audits.demosales.net
and that works.
It's out side my root directory it's at
Quote:
Originally Posted by Shadow Wizard
no it's not. if it were outside of the website, you couldn't have such code working:
Code:
Call objUpload.File(x).SaveToDisk(Server.MapPath("\audit_images") , objUpload("name"))
the code in bold is mapping folder that reside in the website to actual disk path.
June 7th, 2006, 07:46 AM
Moderator From Beyond
Join Date: Sep 2004
Location: Israel
ok, weird.
anyway, create file called "ShowImage.asp" and have such code in there:
Code:
<% Option Explicit %>
<% Response.Buffer=True %>
<%
'adBinary: 128
'adVarBinary: 204
'adTypeBinary: 1
Const FOLDER_NAME="\audit_images"
Public strImageName, objStream, strImagePath
strImageName = Request("image")
strImagePath = Server.MapPath(FOLDER_NAME) & "/" & strImageName
Set objStream=Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1 'adTypeBinary
objStream.LoadFromFile strImagePath
Response.ContentType = "Image/JPEG"
Response.BinaryWrite objStream.Read(objStream.Size)
Response.Flush
objStream.Close
Set objStream = Nothing
%>
now to show the image, have this html:
Code:
<img src="ShowImage.asp?image=<%= objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
June 7th, 2006, 07:53 AM
I-Team User
Join Date: May 2006
Location: Florida
Thanx Man U r the wizard.
look for me on my profile thread u replied to, i'm going to work on that today.
Quote:
Originally Posted by Shadow Wizard
ok, weird.
anyway, create file called "ShowImage.asp" and have such code in there:
Code:
<% Option Explicit %>
<% Response.Buffer=True %>
<%
'adBinary: 128
'adVarBinary: 204
'adTypeBinary: 1
Const FOLDER_NAME="\audit_images"
Public strImageName, objStream, strImagePath
strImageName = Request("image")
strImagePath = Server.MapPath(FOLDER_NAME) & "/" & strImageName
Set objStream=Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1 'adTypeBinary
objStream.LoadFromFile strImagePath
Response.ContentType = "Image/JPEG"
Response.BinaryWrite objStream.Read(objStream.Size)
Response.Flush
objStream.Close
Set objStream = Nothing
%>
now to show the image, have this html:
Code:
<img src="ShowImage.asp?image=<%= objRS("cnum")%>.jpg" alt="Need To Upload Picture" width="225" height="150"border="0">
Thread Tools
Search this Thread
Display Modes
Rate This Thread
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off