By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

<INPUT type="file" runat="server" - attach to email

P: n/a
Is there a way that I can attach the uploaded file from a client web site to the web server without first storing the uploaded file on the server?

Currently on my local PC (local host) the following code works but not when I run the app from a web server it fails:

private void StoreFile(HttpPostedFile uploadedFile)
{
FileInfo uploadedFileInfo = new FileInfo(uploadedFile.FileName);
......
uploadedFileInfo.CopyTo(fileName, true); // fails on server but not on local host
}
and then later
public void SendEmail(string sendTo, string fileName, string subject, string eMessage)
{
......
MailAttachment ma = new MailAttachment(fileName,MailEncoding.Base64);
}

The upload fails every time
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I think you have to enable "write" right for ASPNET(or other impersonation
account you used) account on the server first for HtmlInputFile.CopyTo() to
work.

"SibAndela" <Si*******@discussions.microsoft.com> bl
news:38**********************************@microsof t.com g...
Is there a way that I can attach the uploaded file from a client web site to the web server without first storing the uploaded file on the server?
Currently on my local PC (local host) the following code works but not when I run the app from a web server it fails:
private void StoreFile(HttpPostedFile uploadedFile)
{
FileInfo uploadedFileInfo = new FileInfo(uploadedFile.FileName);
.....
uploadedFileInfo.CopyTo(fileName, true); // fails on server but not on local host }
and then later
public void SendEmail(string sendTo, string fileName, string subject, string eMessage) {
.....
MailAttachment ma = new MailAttachment(fileName,MailEncoding.Base64);
}

The upload fails every time

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.