#1 2006-08-26 03:24:57

santon
Member
RankingRanking
Registered: 2006-07-31
Posts: 11
Reputation :  [+ 1/ -0 ]
Expertise

File attachment with asp

Hi all,

I need to send a file attachment with my email to the selected users here mail sending works properly
but i can't send the attached file with that can anyone help me on this

here is my coding

//-----------------------------
Dim obj
subject = Request.Form("subject")
body = Request.Form("body")

if subject <> "" then

str3=split(session("data"),",")
response.write(session("data"))
for i =0 to ubound(str3)
set obj = server.CreateObject("Cdonts.Newmail")
obj.To = str3(i)
obj.From ="mahesha@webcaresys.net"
obj.Subject = subject
obj.Body = body
'FreeTools = Request.Form("T2")
'obj.AttachFile(FreeTools)
obj.Send


Next


end if

//-----------------
this is the field to fasilitate the file attachment

//-----------------------
<td width="115" bgcolor="#fffdf0"><font class="smalltxt">&nbsp;</font><font class="smalltxt">Attach File</font></td>
<td width="495" bgcolor="#fffdf0">&nbsp; <input type="file" name="T2" size="23" class="design"></td>
//---------------------------------


Need ur help

Offline

 

#2 2006-08-27 03:11:27

cyrus
Member
RankingRanking
Registered: 2006-07-19
Posts: 32
Reputation :  [+ 1/ -0 ]
Expertise

Re: File attachment with asp

With ASP you need to have an upload component installed on your server to do this. Find out which one your hosting company has installed and then Google it/visit the official site - there are bound to be code snips and a manual for it. Do some test uploads, and if you're still struggling to combine that with your mail script, come back and I'm sure we can help... smiley-walkman

Offline

 

#3 2007-04-17 02:49:27

Gracia
Member
RankingRanking
Registered: 2007-04-16
Posts: 18
Reputation :  [+ 1/ -0 ]
Expertise

Re: File attachment with asp

You're talking about uploading a file that is, then, subsequently attached to a server-side mail? Such a file would have to be stored on your server, first, before it can be attached to a server-side mail. Thus, checking the file extension is pretty straightforward:

Code::

Dim ext, pos, str
ext = LCase(Request.Form("AttachFileName"))
pos = InStrRev(1, ext, ".", vbTextCompare)
If pos > 0 Then ext = Mid(ext, pos + 1)
If ext <> "doc" And ext <> "txt" And ext <> "xls" Then
Response.Write "<p>Invalid file extension.</p>" & vbCrLf
Response.End
End If

Offline

 

Board footer

OPML feedsRSS feeds



Powered by WWWThreads Forum
© Copyright 2006, WWWThreads