AjaxFileUpload corrupt files if the file name contains Arabic text ! RRS feed

  • Question

  • User1750468801 posted

    After uploading so many files using AjaxFileUpload , I noticed all files uploaded to the server are corrupted.  The error message I get is "Excel can not open the file عربي.xlsx because the fileformat or the file extention is not valid".

    If I change the file name from (عربي.xlsx) to (arabic.xlsx) and reupload the file then the file works!

    more strange than that is when I tried to upload empty text file with arabic name and when I opened the file , the file opened correctly , but I found letter "n" in the content of the file which I didn't add in the first place !

    Can someone explain how I can resolve this issue ? Thank you

    Thursday, April 17, 2014 7:23 AM

All replies

  • User1750468801 posted

    Can someone please help me resolve this issue ?

    Saturday, April 19, 2014 11:03 AM
  • User-1561933206 posted


    Not sure but you might like to change the culture info of your page hosting file upload.


    See if this works

    Saturday, April 19, 2014 4:16 PM
  • User1750468801 posted

    I changed the culture , still not working.

    Sunday, April 20, 2014 1:51 AM
  • User-417640953 posted

    Hi bomayed,

    Thank you post the issue to asp.net forum.

    Just for a diagnosis, please try to upload the excel file with the عربي.xlsx name, then try to change the file name as arabic.xlsx in the

    AjaxFileUpload1_UploadComplete method like below.

     protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
                var filename = "Arabic" + System.IO.Path.GetExtension(e.FileName);
                AjaxFileUpload1.SaveAs(Server.MapPath("~/Files/") + filename);

    Then see if it ok. If not please see below similar thread AjaxFileUpload file name cannot contains special chars, and vote it.



    Best Regards!

    Sunday, April 20, 2014 9:56 PM