> does the directory XPDL exist in your webapp root ? is it writeable by
> the servlet ?
Yes; i've tried it
>
> try setting upload-directory to an absolute path which is writable. then
> check if
> your file is placed there by cocoon.
>
> also, please send the html code of the overall generated form.
This is the generated code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Nikko Administration</title>
<meta http-equiv="Cache-Control" forua="true" content="max-age=0">
<meta content="NO-CACHE" http-equiv="PRAGMA">
<link title="web" rel="stylesheet" media="screen" href="style.css">
<script language='javascript'
src='http://127.0.0.1:3810/js.cgi?caw&r=6191'></script>
</head>
<body>
<center>
<div id="pagina">
<div id="banner">
<div style="padding-left:68px;padding-top:4px;float:left;">
<p>
<span style="font-size:14px;font-weight:bold;color:white;">Nikko</span>
</p>
<p>
<span style="font-size:10px;font-weight:normal;color:white">
Services
&
CMS
</span>
</p>
<p>
<span style="font-size:10px;font-weight:normal;color:white">on Demand</span>
</p>
</div>
</div>
<div id="corpo">
<div style="margin:10px 10px 10px 10px;">
<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
<!--
Copyright 2002-2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<title xmlns:[EMAIL PROTECTED]@#="[EMAIL PROTECTED]@#">Upload XPDL/XML
file</title>
<content>
<para>Scegliere il descrittore XML o XPDL che si vuole caricare</para>
<form action="046f555101524b3d56527613485c82466e6e2977.kont" method="POST"
onsubmit=" forms_onsubmit();
">
<div>
<input name="forms_submit_id" type="hidden">
</div>
<table>
<tr>
<td valign="top">
File da uploadare
</td>
<td valign="top">
<input accept="text/xml" title="Scegliere un file di tipo XPDL o XML"
name="upload" id="upload" type="file">
</td>
</tr>
</table>
<br>
<input type="submit" value="Upload">
</form>
</content>
</page>
</div>
</div>
</div>
</center>
</body>
</html>
I have also attached it in a file called insert.txt. If i see the output i have:
17:39:22,688 INFO [js] Sono qu�
17:39:49,336 INFO [js] Ho ottenuto: [[object Widget (Upload)]]
17:39:49,336 INFO [js] uploadWidget.getValue(): null
17:39:49,336 INFO [js] uploadWidget.value: null
17:39:49,336 INFO [js] handleUpload
17:39:49,346 INFO [js] uploadWidget.getValue(): null
17:39:49,346 INFO [js] uploadWidget.value: null
17:39:49,346 INFO [js] Era nullo
The functions are:
function upload() {
var log = Logger.getLogger( "it.eng.nikko.workflow.upload.js" );
log.info( "Sono qu�" );
var form = new Form("forms/uploadForm.xml");
var k = form.showForm("uploadFile.jx");
//k.invalidate();
var uploadWidget = form.lookupWidget("upload");
log.info( "Ho ottenuto: ["+uploadWidget+"]" );
log.info( "uploadWidget.getValue(): "+ uploadWidget.getValue() );
log.info( "uploadWidget.value: "+ uploadWidget.value );
var content = handleUpload(form);
var fileName =
form.lookupWidget("upload").getValue().getHeaders().get("filename");
log.info( "Upload finished....." );
cocoon.sendPage("uploadSuccess.jx",
{
uploadContent: content,
filename: fileName
}
);
}
function handleUpload(form) {
var log = Logger.getLogger( "it.eng.nikko.workflow.upload.js" );
log.info( "handleUpload" );
var buf = new java.lang.StringBuffer();
var uploadWidget = form.lookupWidget("upload");
log.info( "uploadWidget.getValue(): "+ uploadWidget.getValue() );
log.info( "uploadWidget.value: "+ uploadWidget.value );
if (uploadWidget.getValue() != null) {
log.info( "in if" );
var realPath = java.lang.System.getProperty( "realPath" );
var dir = new java.io.File( realPath+"/procDef/" );
if( !dir.exists() ){
dir.mkdirs();
}
var myFile = new java.io.File( dir, getFileName( uploadWidget.getValue() )
);
var writer = new java.io.PrintWriter ( new java.io.FileOutputStream( myFile
) );
var stream = uploadWidget.getValue().getInputStream();
var reader = new java.io.BufferedReader(new
java.io.InputStreamReader(stream));
var line;
while ((line=reader.readLine())!=null){
buf.append(line).append("\n");
writer.println( line );
}
reader.close();
writer.close();
UploadXPDL.doUpload( myFile );
}else{
log.info( "Era nullo" );
}
return buf.toString();
}
function getFileName( path ){
var strTok = new java.util.StringTokenizer( path,"/" );
var workFlowFile = null;
while( strTok.hasMoreTokens() ){
var token = strTok.nextToken();
if( ( token.indexOf( ".xml" ) > -1 ) || ( token.indexOf( ".xpdl" ) > -1 )
){
workFlowFile = token;
}
}
return workFlowFile;
}
As you can see it's the lookupWidget.. or better it's the getValue method that
give me null... have you any idea
I really don't understand.
Thanks
>
> Regards,
> Johannes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
____________________________________________________________
Regala e regalati Libero ADSL: 3 mesi gratis, navighi veloce e scarichi a 1.2
Mega.
Abbonati subito senza costi di attivazione su http://www.libero.it
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]