Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cant view attachments correctly

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
because I dont have the ability to write to the drive in my ASP ( I dont think my webhoster's allow it, but I'll ask later) I am using JMail, I want to be able to allow the user to download or view attachments this is how I am doing it so far with an ASP that I Send the Message # and the Attachment #, then it sets itself as the content type of the attachment and responds with the attachment data, here is the file.

Code:
<%@ Language=VBScript %>
<%
if (Session(&quot;uid&quot;) = &quot;&quot;) or (Session(&quot;pwd&quot;)= &quot;&quot;) then
	Response.Write &quot;Your UserID and Password Sessions have expired please relogin&quot;
else
	Set pop3 = Server.CreateObject( &quot;JMail.POP3&quot; )
	pop3.Connect Session(&quot;uid&quot;), Session(&quot;pwd&quot;), &quot;mail.kb244.com&quot;
end if

    if pop3.count > 0 then
			set msg = pop3.Messages.item(Request(&quot;index&quot;))

			Set Attachments = msg.Attachments
			Set at = Attachments(Request(&quot;aindex&quot;))
			Response.ContentType = at.ContentType 
			Response.Write at.Data
      end if
      pop3.Disconnect
%>
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
what happens, is for example, if I attached a jpg to an email, in IE it just shows that little picture box with the &quot;x&quot; in it. if I attached an executable, the save file dialog would pop up asking me to save 'viewattach.asp' but opening the asp I do see hex data.
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
I found out I have to use Response.BinaryWrite, it does respond with 100% of the data to the client, but I Still cant see images, and my downloadibles are still saved as the ASP's name
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top