问题
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