cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: upload widget
Date Mon, 17 Mar 2008 14:26:38 GMT
Peter Sparkes schrieb:
> Thanks Grzegorz,
>
> Unfortunately I can't get it to work, code is:
>
> function upload() {
>      var form = new Form("forms/upload_model.xml");
>    var k = form.showForm("upload-display-pipeline.jx");
>
>    k.invalidate();
>
>    var widget = form.getChild("upload");
>    var uploadedContent = handleUpload(form);
>    var part  = widget.getValue();
>    part.copyToFile("new.pdf") ;

I don't think that 'part' implements a the function 'copyToFile' (at 
least I haven't found it).
I get the file path of the uploaded file by
var filePath = widget.getValue().getFile();
Then you can copy it via custom copy functions to where you want.

I disabled the "k.invalidate()" and keep the file also after the request 
"upload.getValue( ).setDisposeWithRequest( false );" is gone (file is by 
default disposed with the request) because I copy it not within the 
request - but I must take care mayself after copying the the file gets 
deleted.

<snip>
var uploadWidget = form.lookupWidget( "upload" );
var k = form.showForm( screen );
// k.invalidate(); // do not allow return to the form
if( upload.value != null ) {
  var filePath = upload.value.file;
   upload.getValue( ).setDisposeWithRequest( false );
}
</snip>

HTH
Felix



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message