showurl(f.URLPath)

Hi,

For some reason I’d like to be able to present local files to my user from my Web App.

So this is what I did:

[code] f=GetFolderItem(“File.pdf”)
showurl(f.URLPath) //Nothing happens

[/code]

But it does not work in the Web Edition, Same code in Desktop works as I want it to.

The reason for this is to avoid sending large PDF-files over the Web Server when the user actually is already having the PDF in his file system.

showurl seems to work fine with http:// but not with file://

Any ideas?

Dan

[quote=170377:@Dan Berghult]Hi,

For some reason I’d like to be able to present local files to my user from my Web App.

f=GetFolderItem("File.pdf") showurl(f.URLPath) //Nothing happens

[/quote]

For the web app, local is the server, not the user computer. A web app has no access to the user file system. file:// refers to the server file system.

Right. “file://” works with the local file system. You cannot present local server files to the user like that.

You’ll need to point a WebFile to your file and then present its URL in your web app.

I see.

Just so I understands it correctly:

I must always serve my PDF’s thru the Web Server?

Yes.

No. You can use a WebFile instead. Make a property or array in a module for keeping track of them and then do something like this:

[code]Dim wf as new webfile
wf.open(f,false) // Use false to keep the reference on disk
showurl(wf.url)

// Append it to the storage array so it doesn’t go out of scope before the browser gets it.
myFileArray.append wf
[/code]