2

If file is dragged and dropped from file explorer it has FileAttributes.ReadOnly flag for StorageFile.Attributes parameter. In that case using StorageFile api to write to file will give error. How to write to file in this case??

Soumya Mahunt
  • 2,148
  • 12
  • 30

1 Answers1

1

In this case PathIO api can be used to write to file (unless file is a system file). Convert data to write into bytes array and then add following code to write to file:

await PathIO.WriteBytesAsync(file.Path, bytes);

This will write to these files without any error. You don't need any additional permission like broadFileSystemAccess for this.

Soumya Mahunt
  • 2,148
  • 12
  • 30