Jeroen Reijn wrote:

Hi,

maybe i'm thinking in the wrong direction, but the error messege says that it's getting a String.
Is your form type correct("multipart") ?


Just my 2 cents.

That (String) can also happen if uploads are not turned on in web.xml - in case these are different webapps, or on different servers.


Geoff


-----Original Message-----
From: olivier demah [mailto:[EMAIL PROTECTED]
Posted At: Tuesday, April 20, 2004 6:23 PM
Posted To: Cocoon User List
Conversation: Flowscript to Uploadfile
Subject: Flowscript to Uploadfile


Hi,
i try to upload some images and i use => http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadsWithFlow


it's working on some js but failed on one :


this one works :


var role = 'org.apache.cocoon.components.upload.FileUploadManager';

function upload_shop_photo() {
var uploader = cocoon.getComponent(role);
var part_shop = cocoon.request.get("shop_photo");
try {
uploader.setUploadFolder("/home/fox_cocoon/build/webapp/vieira/images/shop");
uploader.upload (part_shop);
cocoon.sendPage("success.html");
} catch (Exception) {
cocoon.sendPage("failure.html");
}
}


this one does not :
var role = 'org.apache.cocoon.components.upload.FileUploadManager';

function upload_player_photo() {
var uploader = cocoon.getComponent(role);
var part = cocoon.request.get("player_photo");
try {
uploader.setUploadFolder("/home/fox_cocoon/build/webapp/vieira/images");
uploader.upload (part);
cocoon.sendPage("success.html");
} catch (Exception) {
cocoon.sendPage("failure.html");
}
}




my sitemap with the javascript and pipeline :
    <map:match pattern="do-*-*.html">
        <map:generate src="xsp/{2}.xsp" type="serverpages">
            <map:parameter name="action" value="{1}"/>
        </map:generate>

         <map:select type="request-parameter">
             <map:parameter name="parameter-name" value="upload"/>
            <map:when test="news">
              <map:call function="upload_news_photo"/>
            </map:when>
            <map:when test="shop">
              <map:call function="upload_shop_photo"/>
            </map:when>
            <map:when test="gallery">
              <map:call function="upload_gallery_photo"/>
            </map:when>
            <map:when test="player">
              <map:call function="upload_player_photo"/>
            </map:when>
        </map:select>

        <map:transform type="cinclude"/>
        <map:transform src="xsl/admin.xslt"/>
        <map:serialize type="html"/>
    </map:match>

  </map:pipeline>
</map:pipelines>

<map:flow language="javascript">
    <map:script src="js/upload_gallery.js" />
    <map:script src="js/upload_photo.js" />
    <map:script src="js/upload_player.js" />
    <map:script src="js/upload_shop.js" />
</map:flow>


the diff between upload_player and upload_shop is the name of the function of course and the var part where the name differ.


the following error occurs :
"file:/home/fox_cocoon/build/webapp/vieira/admin/js/upload_player.js", line 8: Can't find method org.apache.cocoon.components.upload.FileUploadManagerImpl.upload(string).


i already met this problem before and just change the var part = cocoon.request.get("player_photo"); to something like var part_shop ; but here nothing goes better.


any ideas are welcome.




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



Reply via email to