如何从文件元数据c#中删除特殊字符

时间:2015-07-14 09:16:13

标签: c# asp.net file file-upload special-characters

我试图从最近2个小时找到解决方案,我已经搜索了很多但没有找到任何解决方案(可能是我正在搜索错误的关键字),但问题是我想删除包含特殊字符的文件属性。请查看附图,了解我想说的内容。

我使用ASP.NET FileUpload控件和C#作为编程语言。我想确保上传的任何文件的属性中都不包含任何特殊字符。

enter image description here

请帮忙。

感谢。

1 个答案:

答案 0 :(得分:1)

您是否尝试过循环Image.PropertyItems

您可以修改图片,以通过GetPropertyItem()SetPropertyItem()

删除不需要的详细信息

参考文献: 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

StackOveflow中的示例: Value of image property (C#)