rn**@rediffmail.com wrote:
I came across this article titled Pure ASP File Upload at
http://www.asp101.com/articles/jacob/scriptupload.asp & tried
it on my local IIS5.1. Intranet server & it worked. I saved the
necessary data in a MS-Access database file (& not in the hard
disk).
Can someone please tell me how do I mail the uploaded file as
an attachment using CDO.MESSAGE?
This is fairly simple. You need an ASP script that will stream the file to a
browser, based on some key to the DB record. Then you construct a URL for
use in the AddAttachment method of the CDO.Message object.
IMessage.AddAttachment(URL,[UserName],[Password]) ...
"The URL prefixes supported in the URL parameter are file://,
ftp://, http://, and
https://. The default prefix is file://.
This facilitates designation of paths starting with drive
letters and of universal naming convention (UNC) paths."
http://msdn2.microsoft.com/en-us/library/ms526983.aspx
To give you an example, here is a segment of code from a feedback form I
use. In it, I call a stored procedure that returns a list of files to be
attached to the message, then makes successive calls to AddAttachment():
for (CN.File_ListByRequest(GUID,"Feedback","Attachment ",RS); !RS.EOF;
RS.MoveNext())
MSG.AddAttachment([My script URL] + "?RecordID=" +
RS.Fields("RecordID").Value)
Those calls, in turn, trigger this script (excerpted, of course):
var RecordID = Request.QueryString("RecordID").Item,
CN = Server.CreateObject("ADODB.Connection"),
RS = Server.CreateObject("ADODB.Recordset")
CN.Open(*** my connection string ***)
CN.File_Retrieve(RecordID,RS)
if (!RS.EOF) {
Response.AddHeader("Content-Length",RS.Fields("FileSize").Value)
Response.AddHeader("Content-Disposition","inline; filename=" +
RS.Fields("FileName").Value + ";")
Response.ContentType = RS.Fields("ContentType").Value
Response.BinaryWrite(RS.Fields("Data").Value)
}
RS.Close()
CN.Close()
As you may have guessed, these are JScript examples.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.