upload remote files web enabled apps

Upload Remote Files in Web-Enabled Applications

Upload Remote Files in Web-Enabled Applications

upload remote files in web-enabled apps

At first, the file handling dual behavior in a Thinfinity® VirtualUI web-enabled application can appear to be a bit confusing for new developers and users who are accustomed to running the application from the desktop. It’s actually pretty simple, as you will see in this article.

Previously, we shared with you a brief summary of the file handling possibilities in Thinfinity® VirtualUI apps. In this opportunity, we will try to shed some light on this topic and show you how to upload remote files in web-enabled applications.

Getting Files from the Browser

A VirtualUI web-enabled application has the ability to open files from its application environment, as usual, by using the standard file system dialog. But if the developer sets VirtualUI.StdDialogs to false, when a user calls the application from the browser and wants to open a file, a special dialog box will appear to allow a file upload.

Why upload remote files and not open them?

When you use a web-enabled application from the browser, the communication is enabled through a server application: the Thinfinity® VirtualUI Server. In this way, you are actually using the app remotely, from the Web.
So, when you need to select a file located in the browser’s device to be read by the application, you need to do a file upload in order to send a file from the browser environment to the web-enabled application, which is running in the VirtualUI Server.

Activating the remote file mode

In order to activate the file upload, the developer has to set the VirtualUI.StdDialogs (for standard dialogs) attribute to false.

VirtualUI.StdDialogs := false;

To go back to using the standard Windows File Open dialog and do a common file open on the application machine or local network, the developer has to set this attribute to true. If you do this, the remote file upload will be deactivated.

Where is the uploaded file?

By default, the uploaded files are stored automatically in a public server folder (i.e. C:\Users\Public\Documents\Cybele Software\Thinfinity\VirtualUI\). Developers can retrieve uploaded files from this folder in order to handle them.
But if the developer wishes to use a different folder, Thinfinity® VirtualUI has additional ways to upload files to any other destination.

Changing the destination folder

The VirtualUI class has an event method called OnGetUploadDir which is fired during an upload request, allowing you to change the save folder.
This Delphi example shows how to define it:

procedure TMyForm.MyGetUploadDirHandler(Sender: TObject; var Directory: string; var Handled: Boolean);
begin
  Handled := True;
  Directory := ExtractFilePath(Application.ExeName);
End;
...
...
VirtualUI.OnGetUploadDir := InternalGetUploadDir;

Another way to upload remote files

The VirtualUI class has an additional method to upload files from the browser. This method is:

virtualui.UploadFile(‘selected folder’);

Where virtualui is an instance of the VirtualUI class. This method allows you to upload files from browsers and store them in a selected folder. The UploadFile method is independent of the StdDialogs attribute status and, of course, it is not available when the application is used in desktop mode.

How to change the folder

If you have the need to change the destination folder, you may use the event: ‘onUploadEnd’
Find an example here (zip file).

Conclusions

Nowadays, the Web imposes many necessary security measures which end up limiting the use of web-enabled applications. Thinfinity® VirtualUI manages to integrate remote file handling securely, allowing the user to perform typical operations seamlessly.

VirtualUI File Handling series:
Upload remote files in VirtualUI web-enabled apps
Download files from VirtualUI web-enabled apps

Have any questions?

Book a call today to learn more about how Thinfinity® can help your organization. We are always available to guide you and provide the best solution based on your specific needs.

10 Comments

Keith
Reply
May 1, 2021 at 12:45 pm

How do you ensure the files remain in the selected folder after uploading or downloading. The system seems to clear the temporary folders when the browser session ends?
UploadFile does not work in C++. Compiler complains “no member named UploadFile” in VirtualUI.
I am a trial user only.

Fernando
Reply
February 18, 2020 at 10:32 am

Can I change the destination folder of the files to upload from the server administrator?

Jon Robertson
Reply
April 26, 2017 at 3:54 pm

I agree wholeheartedly with Walter. Would you please update the post or post another reply with the answer to Zagreus’ question? (How to know when upload is finished.)

Walter
Reply
September 21, 2016 at 8:44 am

@Mariana:
Could You please make this kind of info available to the public too instead of only to the one user who asked?
I think it’s important for everyone using VirtualUI.
It’s very inconvenient to have to ask for an email to get this info.
If You’re in the middle of something and have a time delay of some hours or in my case a day (because of my timezone UTC+2) until I get a response, that’s a big problem.
It would be even better to find something like that in the documentation.
Walter

Mariana
Reply
August 3, 2016 at 6:45 pm

Hi! Thanks for your inquiry! We’ve sent you an email with the answer.
Anytime you have a quick question like this, feel free to open a live chat or email us for a quick response. 🙂
Best regards,
Mariana

    GLENN RATHKE
    Reply
    May 26, 2020 at 2:46 pm

    After the upload file directory has been set with m_VirtualUI>>UploadFile(QRY_CurrentUser_Get.Email)
    How do you retrieve directory location?

Zagreus Zag
Reply
July 20, 2016 at 5:50 pm

How do I know uploading process has finished?

    Sergio Hernandez
    Reply
    June 7, 2017 at 11:02 am

    You can be notified by defining the event VirtualUI.OnDownloadEnd so your custom code will be called with the full file name of the downloaded file, so you can safely delete it, for instance.

      Mark Swann
      Reply
      August 10, 2017 at 1:43 pm

      Can you provide an example of this event handler, specifically, how to get the full file spec (name and path)?

Add Comment

Thinfinity_logo

Get a Demo

Experience how Universal ZTNA with Thinfinity® integrates with VDI and DaaS for unmatched security and flexibility.

Blogs you might be interested in

<span>Application Virtualization</span>, <span>HTML5 Conversion</span>, <span>Independent software Vendor (ISV)</span>, <span>IT Developer</span>, <span>SDK</span>, <span>Secure Application Delivery</span>, <span>Thinfinity VirtualUI</span>, <span>Windows Integration</span>