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

Discussion in 'ASP .Net' started by =?Utf-8?B?U2liQW5kZWxh?=, Jul 31, 2004.

  1. 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
     
    =?Utf-8?B?U2liQW5kZWxh?=, Jul 31, 2004
    #1
    1. Advertising

  2. 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" <> ¦b¶l¥ó
    news: ¤¤¼¶¼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
     
    Lau Lei Cheong, Aug 2, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Sandfox
    Replies:
    1
    Views:
    1,186
    Jason DeFontes
    May 11, 2004
  2. yoshra
    Replies:
    0
    Views:
    584
    yoshra
    May 8, 2005
  3. =?Utf-8?B?SmFpbWUgU3R1YXJkbw==?=

    Difference between <asp:textbox> and <input runat="server">

    =?Utf-8?B?SmFpbWUgU3R1YXJkbw==?=, Oct 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    7,462
    Mr Newbie
    Oct 7, 2005
  4. Replies:
    0
    Views:
    663
  5. Warren Tang
    Replies:
    1
    Views:
    553
    Warren Tang
    Sep 17, 2008
Loading...

Share This Page