controlling upload

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

controlling upload

Adrian Baker
I'm using the <xf:upload> control, and I'm trying to understand the timing of the actual upload from the browser to the server.

The sample upload form seems to trigger this with a 'dummy' submission:

    <xforms:submission id="background-submission" method="post" replace="instance" action="/xforms-upload/background" instance="response-instance"/>
    ...
    <xforms:trigger ref="instance('control-instance')/simple-upload-trigger">
        <xforms:label>Upload Selected Files</xforms:label>
        <xforms:action ev:event="DOMActivate">
            <xforms:setvalue ref="instance('files-instance')/action">simple-upload</xforms:setvalue>
            <xforms:send submission="background-submission"/>
        </xforms:action>
    </xforms:trigger>

Am I correct in thinking the dummy submission does nothing except trigger a HTML form submission from the browser? Which occurs from xforms.js:

    // Submit form
    case "submission": {
        ..
        if (replace == "all") {
            ...
        } else {
            // Submit form in the background
            YAHOO.util.Connect.setForm(ORBEON.xforms.Globals.requestForm, true, true);
            var callback =  {
                upload: ORBEON.xforms.Server.handleUploadResponse,
                failure: ORBEON.xforms.Server.handleFailure
            }
            YAHOO.util.Connect.asyncRequest("POST", action, callback);
        }
        ORBEON.xforms.Globals.formServerEvents[formIndex].value = "";
        break;
    }

So.. if I want to do a background/asynchronous upload it seems:
 - I need to trigger a dummy replace="instance" submission. Which instance is submitted is irrelevant.
 - I can't control which upload controls are uploaded: all upload controls will be sent when the form is submitted, except for those which are blank or already submitted.

Correct?

Also, once the upload has been triggered there is currently no mechanism to cancel an upload in progress?

thanks,
Adrian




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws