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

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
 
L

Lau Lei Cheong

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top