Jump to content

UniHTMLFrame and Server Path


Volk65

Recommended Posts

Hi!

This code works: 
  UniHTMLFrame.URL := UniServerModule.FilesFolderURL+ExtractFileName(FileName); //     files/doc1.pdf  -- PDF is displayed

But this code doesn't work: 
  UniHTMLFrame.URL := '\\ServerName\SharedFolder\SubFolder\doc1.pdf';  //   UniHTMLFrame is blank (file exists)

How to display a file in a shared folder?

Link to comment
Share on other sites

We had a similar requirement.

First of all, understand: URLFrame.URL is basically a way for you to get the browser to ask for a specified URL (file) in a totally standard "http/s" way.  So you must think in terms of "URL" not "shared folder" in the first instance.  Next, UniGUI's "FilesFolderURL" gives you a way to get a URL to refer to files in a known UniGUI FilesFolder location, via an HTTP/S URL therefore recognized by the UniGUI server.  So, thats one way to get UniGUI to do the "translation" from server based path/file location to something that UniGUI will recognize an serve to a client browser.  Of course it doesn't help you because you're interested in some other shared location accessible by your server.  It follows that since UniGUI doesn't know about this location, you must implement something similar to what UniGUI does for its file/folder location.

In short, to solve this we implemented a servermodule event handler/method (sorry I don't have the code in front of me otherwise I'd perhaps be a bit more specific) that basically recognizes special URL's requests (by prefix) and which further along the URL contains a file-id (AES256 encrypted filename/path in fact).  The server module then of course decrypts the request and manually/directly serves up the requested file providing the requestor is allowed to do so of course.

That's the essence of it anyway.

Walter

Link to comment
Share on other sites

1 hour ago, wprins said:

First of all, understand: URLFrame.URL is basically a way for you to get the browser to ask for a specified URL (file) in a totally standard "http/s" way.  ....

Thanks for the reply. I understand that. Just in the version of UniGUI 1.10.0.1469 this code worked:
 

FileName:= ' \\Server\Folder\File.ext';
FileExists(FileName); -- = True
UniSession.SendFile (FileName); -- Worked correctly
UniURLFrame.URL:=FileName; -- Worked correctly

In version 1.50.0.1480
 

FileName:= ' \\Server\Folder\File.ext';
FileExists(FileName); -- = True
UniSession.SendFile (FileName); -- also works correctly
UniURLFrame.URL:=FileName;    --- not working anymore

I'll rewrite some of the code, of course. And transfer files from one server to another. I want to understand that this is not a bug of UniGUI developers, that now it will be so, that it is normal.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...