Closed frankyuan closed 6 years ago
(We should update the original SO question when this is solved.)
It is possible that we should handle this on both client and server side (meaning a modification should be made in the main sensenet repo too), to make the server (UploadAction) understand both the filename and filename*. properties of the Content-Disposition header.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
I'm trying to upload file with Chinese file name to sensenet using Content.UploadAsync. For some file names, such as 运维管理.txt , there is an exception "Specified value has invalid Control characters. Parameter name: value". If rename to another file name, maybe it works well. Seems like encode issue. Could you give me some suggestions?
I'm trying to upload file with Chinese file name to sensenet using Content.UploadAsync. For some file names, such as 运维管理.txt , there is an exception "Specified value has invalid Control characters. Parameter name: value". If rename to another file name, maybe it works well. Seems like encode issue. Could you give me some suggestions?
My code:
using (var stream = new FileStream(localFilePath, FileMode.Open)) { await Content.UploadAsync(parentPath, fileName, stream, "File"); } StackTrace:
at System.Net.WebHeaderCollection.CheckBadChars(String name, Boolean isHeaderValue)d__23.MoveNext() in sn-client-dotnet-master\sn-client-dotnet-master\src\SenseNet.Client\RESTCaller.cs:line 490
at System.Net.WebHeaderCollection.Add(String name, String value) at SenseNet.Client.RESTCaller.CreateChunkUploadWebRequest(String url, ServerContext server, UploadData uploadData, String boundary, Stream& requestStream) in sn-client-dotnet-master\sn-client-dotnet-master\src\SenseNet.Client\RESTCaller.cs:line 620 at SenseNet.Client.RESTCaller.