In WinRT there is no FileInfo class, only a StorageFile class.
How can I get the size of a file using the StorageFile class?
In WinRT there is no FileInfo class, only a StorageFile class.
How can I get the size of a file using the StorageFile class?
So here you go:
storageFile.getBasicPropertiesAsync().then(
function (basicProperties) {
var size = basicProperties.size;
}
);
In C#:
StorageFile file = await openPicker.PickSingleFileAsync();
BasicProperties pro = await file.GetBasicPropertiesAsync();
if (pro.Size != 0){}
You should using Windows.Storage.FileProperties for BasicProperties.
Have you tried this:
create_task(file->GetBasicPropertiesAsync()).then([this, file](BasicProperties^ basicProperties)
{
String^ dateModifiedString = dateFormat->Format(basicProperties->DateModified) + " " + timeFormat->Format(basicProperties->DateModified);
OutputTextBlock->Text += "\nFile size: " + basicProperties->Size.ToString() + " bytes" + "\nDate modified: " + dateModifiedString;
});