Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread New File Upload Mechanism - Missing Feature?
Fri, Jul 6 2012 10:39 AMPermanent Link

Mark Brooks

Slikware

Avatar

Hi All,

I wondered if any of you had yet tried to use the new "file upload" mechanism? It certainly seems to work well, however I think it's missing a key feature. There does not appear to be any way of programatically determining when the upload has completed. You can of course hook up to a TPage so the user can see the response, but there is also no way on knowing when this response has been sent back (and then accessing it to check for success or failure). Am I missing something?

Thanks
Mark
Fri, Jul 6 2012 10:47 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< I wondered if any of you had yet tried to use the new "file upload"
mechanism? It certainly seems to work well, however I think it's missing a
key feature. There does not appear to be any way of programatically
determining when the upload has completed. You can of course hook up to a
TPage so the user can see the response, but there is also no way on knowing
when this response has been sent back (and then accessing it to check for
success or failure). Am I missing something? >>

There isn't any way to monitor the progress of a form submittal operation in
JavaScript.  You have to rely on the content that comes back into the output
TPage control, and examine it for success/failure using its document's DOM
nodes and elements.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Jul 7 2012 4:05 AMPermanent Link

Mark Brooks

Slikware

Avatar

"Tim Young [Elevate Software]" wrote:

>There isn't any way to monitor the progress of a form submittal operation in
>JavaScript.  You have to rely on the content that comes back into the output
>TPage control, and examine it for success/failure using its document's DOM
>nodes and elements.

Hey Tim,

Just wanted to summarise my thoughts in respect of this topic. My interest lies specifically around the upload of files to REST APIs where one typically uses a POST to a REST URL. Often one will post multiple files to the same URL and this will not result in an overwrite - it may, for example, simple add to an existing collection (I can explain further if required).

I believe that the current mechanism works well (at least for single file uploads) apart from the inability to receive notification of submission complete. Notification could be achieved by surfacing the OnLoad event of the associated TPage. Having said that, I'm not clear how to then programatically retrieve the contents of the TPage in order to check for success or failure.

I have also struggled with multiple file uploads. If you use multiple upload buttons within a single submission then it seems as if only the first file gets sent (this may be an issue with duplicate boundaries for each). If you try to send them serially via individual submits (via separate panels) then only the last gets sent. I think this is because each successive submit overwrites the previous if it hasn't yet completed (since they are to the same URL). This could be avoided if we knew when a submit was complete however (see previous point) and only send the next one at that time.

In summary, as a form-based, user-interactive mechanism it's simple and nice, but not so great for programmatic control. I appreciate that EWB is seriously restricted by the existing web technology in respect of form submission and a desire to accommodate all browsers.

An alternative, of course, is to simply add support for the newer HTML5 features that are commonplace in Safari, Chrome, Firefox etc (and, allegedly, IE10). This would allow upload via XHR (you'd need to wrap the File API as far as I can see). Combined with a simple test to check for the presence of these capabilities in the host browser (this also seems quite straightforward). In this way we could provide fully-featured uploads, even with progress bars, on all supported browsers, and gracefully fall back to submission for the laggards. This would be a decision of the developer not something you would have to include in EWB.

Ideally, this would be the way to go, however I am more than aware of your pressures and priorities.

Awesome product whatever!

Mark
Mon, Jul 9 2012 12:50 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< I believe that the current mechanism works well (at least for single file
uploads) apart from the inability to receive notification of submission
complete. Notification could be achieved by surfacing the OnLoad event of
the associated TPage. Having said that, I'm not clear how to then
programatically retrieve the contents of the TPage in order to check for
success or failure. >>

I'll be adding an OnLoad event for the TPage shortly that will enable you to
check when the submit receives a response.  As for checking the response, I
also need to add a public property to the framework for retrieving the
textual contents of the document that was loaded as the response.

<< An alternative, of course, is to simply add support for the newer HTML5
features that are commonplace in Safari, Chrome, Firefox etc (and,
allegedly, IE10). This would allow upload via XHR (you'd need to wrap the
File API as far as I can see). Combined with a simple test to check for the
presence of these capabilities in the host browser (this also seems quite
straightforward). In this way we could provide fully-featured uploads, even
with progress bars, on all supported browsers, and gracefully fall back to
submission for the laggards. This would be a decision of the developer not
something you would have to include in EWB. >>

Yes, that is the general idea.  However, please keep in mind that EWB didn't
even have a file upload capability on the list for the initial release, so
this is all being added very late in the process as bare-minimum
functionality.  The simple file upload button took about two weeks to get
straight on IE and FF/WebKit and required that the whole button control
architecture be rewritten to work properly on IE.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com


Mon, Jul 9 2012 3:09 PMPermanent Link

Mark Brooks

Slikware

Avatar



<<I'll be adding an OnLoad event for the TPage shortly that will enable you to
check when the submit receives a response.  As for checking the response, I
also need to add a public property to the framework for retrieving the
textual contents of the document that was loaded as the response.>>

That's just wonderful Tim. It'll make upload much more usable. Much appreciated.

<<Yes, that is the general idea.  However, please keep in mind that EWB didn't
even have a file upload capability on the list for the initial release, so
this is all being added very late in the process as bare-minimum
functionality.  The simple file upload button took about two weeks to get
straight on IE and FF/WebKit and required that the whole button control
architecture be rewritten to work properly on IE.>>

Yup. Totally get this. I understand your desire to get EWB working across all browsers but some of the HTML5 stuff is not only very cool but also being expected now. So I guess there will come a time when some EWB functionality is not IE8 and upwards but maybe just Webkit. Either way, as I said before, this is an awesome product. Looking forward to release 1.00.
Image