【发布时间】:2014-11-07 10:41:17
【问题描述】:
我想在上传到服务器之前计算我的文件大小,在此之前我通过创建一个文件夹将我的文件保存在独立存储中。现在我想获取计算文件大小的路径,但它给出错误“不支持给定路径的格式”
我的代码是:
string filePath = Path.Combine(FolderName, FileName);
string fp = @"ms-appdata:///local//" + imageFolder + "//" + fName; // here I tried "/" and try to append "filePath " directly still throwing same error
FileInfo info = new FileInfo(fp); ////Here it is throwing error "The given path's format is not supported"
var fileLength = new System.IO.FileInfo(fp).Length;
int image_file_size = Convert.ToInt32(fileLength);
此路径的正确格式是什么?
【问题讨论】:
-
这对你有用吗:'Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)'
-
现在我得到这个平台不支持的错误操作:(
标签: c# windows-phone-8