Jump to content

TUniFileUpload needs alternative approach to it's execute method Allowing a list of files to be passed to it, and then uploading without a dialog showing


Recommended Posts

Posted

I have a Stringlist of files I will need to upload after the user selects and checks a few things.  This list is generated via a regular Openfile Dialog, on screen the file names are displayed and some extra info is added.  Then I need to upload them, without another file selection dialog box.

 

Another execute method, where a Stringlist could be passed would be wonderful

Posted
10 hours ago, Sherzod said:

Hello @Todd

Maybe you want something like this?

image.png.b9c70a30436356660e2413a9dcc870e3.png

 

No.  I don't need a Dialog after the user has already selected files.

 

My use is simple,  The user selects several files in the interface.  The complete file names are stored in a Stringlist.  The user makes some options and checks and unchecks some other options in the interface.  Then send the files when they are ready.  No need for a second dialog.  I should be able to pass a list of file names when the user is ready.

 

Reason:  User can ensure the options for the files are set correctly BEFORE any file transfer takes place.

Posted

Did you actually check the example solution I provided? There is no second dialog, as you mentioned.

If that solution does not fully meet your needs, then you should describe your case in more detail.

Since file operations on the client side often require user interaction, we need to understand exactly what you're trying to achieve.

Posted
11 hours ago, Sherzod said:

Did you actually check the example solution I provided? There is no second dialog, as you mentioned.

If that solution does not fully meet your needs, then you should describe your case in more detail.

Since file operations on the client side often require user interaction, we need to understand exactly what you're trying to achieve.

Simply explained again....

 

Step one: User selects files using standard Opendialog.

Step Two: The selected file names are loaded into the interface in UniEdit controls.  Each UniEdit has several Options associated with it that the user then can Check/UnCheck and set the options.

Step 3: user then clicks a button allowing the files to then be uploaded, because the options are set for each.

 

 

The example you linked does not do anything but allow a dialog (That is the SECOND Dialog-which is NOT NEEDED since the files are already selected) to select files, checkmarks to check the files and then the ability to Cancel or upload.

 

I need a way to past a STRINGLIST of file names to UniFileUpload and execute WITHOUT UniFileUpload doing anything but uploading the files passed into it.

 

I can't make this any Simpler.

Posted
On 3/15/2025 at 3:12 AM, Todd said:

I need a way to past a STRINGLIST of file names to UniFileUpload and execute WITHOUT UniFileUpload doing anything but uploading the files passed into it.

Todd,

For security reasons no browser will allow you to get access to files stored on the clients computer by using filenames that are stored in a stringlist.  So there is now way UniFileUpload can do what you are asking for. Remember that in order to get access to the file for upload purposes you need to know the absolute path of the file. This is information the browser does not provide. Event if you knew the path the browser will not accept that information.

The only way you can do what you have in mind is to write your own function in html/javascript. That way you can store the list of files the user has selected as an array of javascript file objects that contain the encrypted file path. You can then subsequently read the files for uploading using the FileReader function that wants the file object as input.

Depending on what it is you need this for I can probably help you to come up with the javascript function you need.

Posted
2 hours ago, Norm said:

Todd,

For security reasons no browser will allow you to get access to files stored on the clients computer by using filenames that are stored in a stringlist.  So there is now way UniFileUpload can do what you are asking for. Remember that in order to get access to the file for upload purposes you need to know the absolute path of the file. This is information the browser does not provide. Event if you knew the path the browser will not accept that information.

The only way you can do what you have in mind is to write your own function in html/javascript. That way you can store the list of files the user has selected as an array of javascript file objects that contain the encrypted file path. You can then subsequently read the files for uploading using the FileReader function that wants the file object as input.

Depending on what it is you need this for I can probably help you to come up with the javascript function you need.

So clicking a button in the Browser, populating the Buttons "File list" and then uploading can't happen?  Thats not true at all.

Once the button is clicked, the user has authorized the upload.  Whether they select the files then, or the interface already has the Absolute file names is irrelevant.  It can be done.

Posted

@Todd

Could you create a test case in VCL demonstrating the desired behavior—uploading a list of files without showing a dialog? This will help determine which functions can be implemented in uniGUI and which cannot...

Posted
5 hours ago, Todd said:

Once the button is clicked, the user has authorized the upload. 

Yes that is true. However when the user activates the file lookup in the browser, the browser returns a file object that, in addition to the filename, also contains other information like file size & date as well a pointer to the file on the harddisk. In order to access the file you must supply the returned file object to the browser. Simply storing the filename as a string value and then trying to use it to access the file at a later time will never work.

Posted
4 hours ago, Sherzod said:

@Todd

Could you create a test case in VCL demonstrating the desired behavior—uploading a list of files without showing a dialog? This will help determine which functions can be implemented in uniGUI and which cannot...

I don't think you read it right....

 

I upload a list of files using the OpenDialog, It populates Several Edits, One file name in each (using Extract File name).  A string list contains the full Path with filename to each of the files.

 

User can then do some settings on a per file basis in the interface.  Then click a button to Actually send the file.  I can do Something in vcl...May take a day or 2...

Posted
11 hours ago, DFong said:

Perhaps studying this example may help you achieve what you want:

Good luck!

I have.  It produces a dialog box(second to the one I create to get the file names).  

×
×
  • Create New...