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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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 said:
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:
 
Back
Top