I appreciate everybody input and patience this is my third week learning C# and ASP, so still a green horn, but I'm learning.
So i can post the file and save the file but when i open the file in word it tells me that it is Word Found Unreadable Content do you want to recover the file Yes, No.
I've trawled the internet and found a few solutions I have focused on these two but I'm still stuck any help would be awesome.
Is HttpPostedDocumentFile
your custom class in your code?
I cannot successfully test your code because your code does not provide comprehensive information, but you can refer to this link to try to change the way to save the file:
Member
3 Points
21 Posts
Word Document Corrupted After Posting to Controller
Dec 10, 2019 09:13 PM|madaxe|LINK
Evening,
I appreciate everybody input and patience this is my third week learning C# and ASP, so still a green horn, but I'm learning.
So i can post the file and save the file but when i open the file in word it tells me that it is Word Found Unreadable Content do you want to recover the file Yes, No.
I've trawled the internet and found a few solutions I have focused on these two but I'm still stuck any help would be awesome.
Thanks
Madaxe
All-Star
52261 Points
23315 Posts
Re: Word Document Corrupted After Posting to Controller
Dec 10, 2019 09:29 PM|mgebhard|LINK
How are you currently uploading the documents? Are you using HTTP multipart form?
I would use HttpClient and you can include the file name in the HTTP message.
https://blogs.msdn.microsoft.com/wsdevsol/2014/03/25/httpclient-and-empty-items-in-a-multipart-form-post/
Member
3 Points
21 Posts
Re: Word Document Corrupted After Posting to Controller
Dec 11, 2019 06:29 PM|madaxe|LINK
Thanks for the response here is the client side code for the word addin
Contributor
3710 Points
1043 Posts
Re: Word Document Corrupted After Posting to Controller
Dec 13, 2019 03:05 AM|Yongqing Yu|LINK
Hi madaxe,
According to your description, please confirm whether the word document can be successfully opened before you upload it?
Usually when a word file becomes corrupted and its contents become unreadable, you may encounter the "Word found unreadable content" issue.
You can refer to this for more information : Word found unreadable content...
Is HttpPostedDocumentFile your custom class in your code?
I cannot successfully test your code because your code does not provide comprehensive information, but you can refer to this link to try to change the way to save the file:
https://stackoverflow.com/a/37291210
Upload files in ASP.NET Core
Best Regards,
YongQing.
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
21 Posts
Re: Word Document Corrupted After Posting to Controller
Dec 13, 2019 05:57 AM|madaxe|LINK
the file is created through the word api or by the user and is fine prior to uploading. I will check out your link to see if i can find a resolution
thanks
Madaxe