我想在上传到服务器之前计算我的文件大小,之后我通过创建文件夹将文件保存在独立存储中 . 现在我想得到计算文件大小的路径,但它给出错误“不支持给定路径的格式”
我的代码是:
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);
这条路径的正确格式是什么?
2 回答
当您在XAML中获取代码时,请考虑这种路径 . 如果你想使用System.IO
然后你需要 Build 这样的路径
此代码正常运行