# Network files selected via OpenFileDialog are not readable

**URL:** <https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650>\
**Category:** Windows\
**Created:** [December 18, 2024, 7:47pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650 "2024-12-18T19:47:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [December 18, 2024, 7:47pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/1 "2024-12-18T19:47:51Z")

</div>

… at least not in my app under windows if they’re on a network-mounted volume. This is 2024r4.1 under macOS Sonoma, building for Windows-10 running in a VirtualBox VM.

I have this code:

```auto
dlg = New OpenFileDialog

dlg.Title = "Select files"
dlg.PromptText = "Select one or more files"
dlg.ActionButtonCaption = "Select"
dlg.AllowMultipleSelections = True
f = dlg.ShowModal

if (f=Nil) then Return

```

Discovering later that I couldn’t read the selected files, I put a breakpoint on the `if` at the end of the code above, and examined the folderitem. It showed `isReadable` and `isWriteable` as both False.

And yet the file in question, a Xojo binary project, could be opened, altered, and saved in the IDE running under Windows 10 in the same VM. Can anyone explain this?

---

<div class="post-metadata">

**Author:** ![Brandon\_Warlick](https://forum.xojo.com/user_avatar/forum.xojo.com/brandon_warlick/32/238_2.png) [@Brandon\_Warlick](https://forum.xojo.com/u/Brandon_Warlick)\
**Post date:** [December 18, 2024, 8:19pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/2 "2024-12-18T20:19:47Z")

</div>

I ran into this or something similar in the past regarding files located in a folder shared by another system on my network. My workaround was to copy the file to the local disk. Not the best solution.

---

<div class="post-metadata">

**Author:** ![Arnaud\_N](https://forum.xojo.com/user_avatar/forum.xojo.com/arnaud_n/32/21824_2.png) [@Arnaud\_N](https://forum.xojo.com/u/Arnaud_N)\
**Post date:** [December 18, 2024, 9:04pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/3 "2024-12-18T21:04:31Z")

</div>

> [@TimStreater](#):
>
> It showed `isReadable` and `isWriteable` as both False.

Have other properties also a default value or they are valid?  
(e.g. if the file can’t be found, “.exists” would also be false, like IsReadable, IsWriteable and all others with a “null” value)

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [December 18, 2024, 10:07pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/4 "2024-12-18T22:07:45Z")

</div>

Fortunately this is simple to test and gives this result: `.Exists` is `True` as is `.Visible`, and `.Length` has the correct value.

And, as I say, the Xojo IDE can open the file.

---

<div class="post-metadata">

**Author:** ![Arnaud\_N](https://forum.xojo.com/user_avatar/forum.xojo.com/arnaud_n/32/21824_2.png) [@Arnaud\_N](https://forum.xojo.com/u/Arnaud_N)\
**Post date:** [December 19, 2024, 8:15am UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/5 "2024-12-19T08:15:05Z")

</div>

> [@TimStreater](#):
>
> And, as I say, the Xojo IDE can open the file.

I’ve seen strange (hard to explain) things in Xojo over the years. It could have been that just because your app has no permission to access the file or one of its subfolders (unlike from the IDE), the resulting folderitem would point to a “non-existent” file, hence the check.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [December 19, 2024, 3:54pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/6 "2024-12-19T15:54:22Z")

</div>

In writing a small test program I discover that the problem is not that a file on a network share is not readable – it is perfectly readable. The problem is that an incorrect value is returned for `.iSreadable`. Here’s my test app running remotely in a WIn-10 VM:

 ![Screenshot 2024-12-19 at 15.45.10](https://forum.xojo.com/uploads/default/original/3X/b/a/bac177c43dbb97916c7cfe10203bb970ded57382.png)

My main app, which reported that the file could not be read, was carefully checking for `.isReadable` being True before proceeding to open/read the file. When I commented out that test, my main app was able to read the file with no difficulties. Which probably explains why the IDE didn’t have a problem opening/reading the file.

So I’ll make an Issue out of this for Windows (tested as not a problem macOS/Lin).

Issue: [https://tracker.xojo.com/xojoinc/xojo/-/issues/78135](https://tracker.xojo.com/xojoinc/xojo/-/issues/78135)

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [December 19, 2024, 10:04pm UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/7 "2024-12-19T22:04:54Z")

</div>

I see this is not an entirely new problem, there have been at least four other similar Issues (such as [https://tracker.xojo.com/xojoinc/xojo/-/issues/22479](https://tracker.xojo.com/xojoinc/xojo/-/issues/22479)) over the last 16 years.

In fact, judging by what @Greg_O had to say in [https://tracker.xojo.com/xojoinc/xojo/-/issues/55731](https://tracker.xojo.com/xojoinc/xojo/-/issues/55731) some five years ago, I may as well just remove my tests for .isReadable. Or I could just #if them out for Windows.

I looked at the doc for those two (.isReadable and .isWriteable). I think it should explicitly state that they are unreliable except for locally mounted devices.

---

<div class="post-metadata">

**Author:** ![Arnaud\_N](https://forum.xojo.com/user_avatar/forum.xojo.com/arnaud_n/32/21824_2.png) [@Arnaud\_N](https://forum.xojo.com/u/Arnaud_N)\
**Post date:** [December 21, 2024, 10:07am UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/8 "2024-12-21T10:07:42Z")

</div>

> [@TimStreater](#):
>
> My main app, which reported that the file could not be read, was carefully checking for `.isReadable` being True before proceeding to open/read the file. When I commented out that test, my main app was able to read the file with no difficulties.

It has been ported to my attention that IsReadable can fail on Windows (there are open bug reports) and shouldn’t be a definitive thing to rely upon.

Also, you’d better try first to open the file without checking anything (beyond the variable being nil, of course, and possibly “exists“ being true) and only if you get an exception you have valid reasons to check the various properties. You can’t even guarantee that, starting with valid properties, just calling methods to open a file will work and won’t modify properties afterward, so don’t waste your energy trying to avoid all the possible troubles before they may happen.

Thanks to Norman for reminding about some of this in a discussion.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [December 21, 2024, 10:29am UTC](https://forum.xojo.com/t/network-files-selected-via-openfiledialog-are-not-readable/83650/9 "2024-12-21T10:29:00Z")

</div>

Yeah. What I’ve done so far, and since these properties appear to be OK on macOS/Lin, is to `#if` the tests so they only act on those OSes. I don’t want to go to the trouble at this point of trying to open them instead (although that would clearly avoid the issue altogether). The point being that at the moment in question, the user is gathering together one or more files for transmission later. It’s more user friendly for them to be notified as they collect each file, rather then be told later that the transmission only sent some of the files. That way they have a chance to do something about it.

I suppose then that the macOS/Linus implementations of SMB are better than Microsoft’s.
