Getting Error for Email Attachment RRS feed

  • Question

  • Hi,

    Created ASP.NET form and there is a file upload control. to upload file(Excel file). If user uploads any file and save the form, then group of people will receive an email with uploaded file as attachment. When email receivers try to open this attachment, they are getting following error.

    Error Message:

    "Excel cannot open the file filename.xlsx because the file format or file extension is not valid. Verify that file has not been corrupted and that the file extension matches the format of the file".

    Can anyone help me out to resolve the issue? 



    • Moved by Fei Hu Tuesday, May 8, 2018 2:59 AM Moved From C#
    Monday, May 7, 2018 2:13 AM

All replies

  • What is size of file? Is same as size of file which you uploaded?
    Monday, May 7, 2018 3:45 AM
  • Hi Petr,

    File size is less.



    Monday, May 7, 2018 4:10 AM
  • Do you flush all streams which you use?
    Monday, May 7, 2018 5:09 AM
  • No, i do not flush.


    Monday, May 7, 2018 6:59 AM
  • Hello OK29,

    According to your question is more related to Asp.Net, You need repost a new thread to ASP.NET forum for better support.


    Best Regards,

    Neil Hu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 8, 2018 2:53 AM