WFileDropWidget questions

Added by Emeric Poupon over 1 year ago

Hello,

I have a couple of questions regarding WFileDropWidget:
- how can I get a popup that allows the user to select files when clicking on the widget? I mean the way it worked with WFileUpload. Without this feature, WFileDropWidget is no use on mobile devices (I could parse the browser agent and just display a WFileUpload instead but that sounds clunky)
- when the user drops a bunch of files, we have to wait for each file to be completey uploaded before doing any validation, which may be annoying when files are quite big. Is there a way to get notified of all the files to be uploaded and then start the upload on demand?

Regards,


Replies (7)

RE: WFileDropWidget questions - Added by Emeric Poupon over 1 year ago

BTW, I can't get the dataReceived() signal working?

RE: WFileDropWidget questions - Added by Emeric Poupon over 1 year ago

(My bad, dataReceived() works fine!)

RE: WFileDropWidget questions - Added by Emeric Poupon over 1 year ago

Well I missed the drop() signal that allows to perform any validation needed.
Actually only my first question remains valid!

RE: WFileDropWidget questions - Added by Korneel Dumon over 1 year ago

Hi Emeric,

that's a valid point. I will look into adding support for this in a future release.

Currently, you can make a hack with a hidden WFileUpload in the background. It is possible to redirect a click on the filedrop-widget to the <input> element of WFileUpload (see link below). Since the WFileUpload usually puts its <input> in a <form> this workaround is quite nasty. I changed the filedrop-example to demonstrate (see attachment).

[[https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications#Using_hidden_file_input_elements_using_the_click()_method]]

filedrop.zip (2.48 KB)

RE: WFileDropWidget questions - Added by Emeric Poupon over 1 year ago

Thanks for your support!

I tried your example but nothing happens when I click on the drop widget? I tried with both chrome and Firefox with no luck.

Do you want that I fill in a feature a request for a better support in a future release?
By the way, what is your strategy about features on wt3/wt4? Only new features on wt4?

Regards,

RE: WFileDropWidget questions - Added by Korneel Dumon over 1 year ago

Right you are ... The problem was with popup-blocking, I had an exception for localhost in firefox, so it worked for me.
Anyway, I rewrote the code not to do a round-trip to the server (see attachment). It should work now.

For wt3, we will continue to provide bug-fixes for about a year. For new features it depends ... This file-drop fallback will also be in wt3.
I made a feature request: [[https://redmine.emweb.be/issues/6160]]

filedrop.zip (2.52 KB)

RE: WFileDropWidget questions - Added by Emeric Poupon over 1 year ago

Strange, it still does not work.

Furthermore I am afraid there is still quite significant work to do to get an unified interface to upload/check/retrieve uploaded files from the two widgets.

But don't worry, I will wait for the official support of this, I can wait :)
Thanks again for your support.

(1-7/7)