B4J Question url to a file outside server folder

le_toubib

Active Member
Licensed User
Longtime User
hi all
i have a server folder (e.g : appserv\www\pdf) located on drive C:
to access files inside this server i use the following code :
access file:
fx.ShowExternalDocument("http://" & serverIP & "/pdf/"& filename)
which works fine.

but , how to access files located outside the entire server folder ? e.g :
"D:\pdf\filename.pdf"
how should the url look like ?
thanks
 

DonManfred

Expert
Licensed User
Longtime User
the file is located on a another device , not the client device
you can NOT use such paths "from another machine". It will only work with such paths on the client device itself.
If you have an UNC-Path to the folder from another device you can use the UNC-Path. This will probably only work if all machines are in the same network.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Thinking...:

A server app is providing the shared resources to clients.
The resources are files.
The app has rights and access to some files on various local locations (drives, folders).
The resource (file) is to be shared when is placed into the shared location, like "appserv\www\pdf" folder.
The clients can make requests for the shared resources into the shared location (schema & "/pdf/"& filename).
The client has no access to files located in other locations, non-shared ("D:\pdf\filename.pdf"), but the app has.
If the app needs some non-local locations file - it is the client itself for some other remote server that shares this needed file. And the app must download the file first from this server2.
 
Last edited:
Upvote 0

le_toubib

Active Member
Licensed User
Longtime User
possible solution :
fx.ShowExternalDocument("http://" & serverIP & ":6000/pdf/"& filename)

server admin provided another port to access the new location.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
serverIP & ":6000

Ports are just channels to separate the several server programs (apps) that share the same domain name within one server host.
Files must be placed into correct shared location tied to the shared folder, that is accessible from Internet.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I can't remember the last time I map a network drive on Windows. It was easy on older version of Windows.
You can map it to the Network and access the folder like \\ComputerName\PDF



B4X:
Dim fx As JFX
fx.ShowExternalDocument("\\T480S\VMShare\Test.txt")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…