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") ;
.......................................


The pdf file is uploaded, but deleted at the end of the request. However it is not copied to new.pdf

Please, what am I doing wrong ?

Peter Sparkes

Peter Sparkes pisze:
Hi,

Following the /upload/ sample in the CForms Block Samples I am trying to upload files, however, the uploaded files are deleted at the end of a request.

Please how do I permanently save the uploaded files.

From form object get upload widget and ask it for its value which is Part[1] object.

You should do something like that:

  part = form.getChild("upload_widget").getValue();

Then it's easy because Part interface has handy methods for accessing the uploaded data.

[1] http://cocoon.apache.org/2.2/core-modules/core/2.2/apidocs/org/apache/cocoon/servlet/multipart/Part.html

I hope this helps.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to