I am using a fileupload widget and flowscript.
My flow function looks like that:
function myTask() {
var form = new Form(cocoon.parameters["definitionURI"]);
form.showForm("myTask-form");
var file = form.getChild("uploadFile");
var viewData = { "filename" : file.getValue() + ".pdf"
in your flowscript do something like:
/** @type org.apache.cocoon.servlet.multipart.Part */
var file = form.getChild("uploadFile").value;
if (file!=null) { // no file upload
var filename = file.filename;
// check for single name and change extension
}
regards
Thomas
Am 19.04.2011 09:47, schrie
with your solution the filename is "undefinded". Is it possible to cast file to
org.apache.cocoon.servlet.multipart.Part to access the filename attribute?
- Ursprüngliche Mail
Von: Thomas Markus
An: users@cocoon.apache.org
Gesendet: Dienstag, den 19. April 2011, 10:02:48 Uhr
Betreff:
yes,
look into org.apache.cocoon.servlet.multipart.Part
there are 2 methods getUploadName() and getFileName()
/Thomas
Am 19.04.2011 13:57, schrieb Matthias Müller:
with your solution the filename is "undefinded". Is it possible to cast file to
org.apache.cocoon.servlet.multipart.Part to access
I searched the cocoon trunk for a similar case and found the solution:
var filename = widget.getValue().getUploadName();
... does the job.
Thanks, Matthias
- Ursprüngliche Mail
Von: Matthias Müller
An: users@cocoon.apache.org
Gesendet: Dienstag, den 19. April 2011, 13:57:13 Uhr
Betr