How to remove special characters from file Metadata c#

泪湿孤枕 提交于 2019-12-25 04:09:29

问题


I am trying to find solution to this from last 2 hours, I have searched a lot on this but didn't found any solution(may be I am searching with wrong keywords), but the problem is I want remove file properties which contain special characters. Please check attached image for what I want to say.

I am using ASP.NET FileUpload control and C# as programming language. I want to make sure that any file uploaded does not contain any special characters in its properties.

Please help.

Thanks.


回答1:


Have you tried looping through Image.PropertyItems?

You can modify the image to remove unwanted details via GetPropertyItem() and SetPropertyItem()

References: https://msdn.microsoft.com/en-us/library/system.drawing.image.propertyitems(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/system.drawing.image.setpropertyitem(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/system.drawing.image.getpropertyitem.aspx

Sample here in StackOveflow: Value of image property (C#)



来源:https://stackoverflow.com/questions/31402506/how-to-remove-special-characters-from-file-metadata-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!