0

How to send request multipart/form-data

asked 2015-07-01 13:55:48 +0800

HuySeven gravatar image HuySeven
1 1

I have a code as below: file "upload.zul"

<div id="S7" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('com.fileupload.FileUploadController')" >

    <html>
     <![CDATA[
        <div onload=init()>
            <form method="post" enctype="multipart/form-data">
                <input type="file" id="uploadPath" onChange="doChange()" width="100%"/>
            </form>
        </div>
     <script>
        function doChange() {
            zAu.send(new zk.Event(zk.Widget.$('$lFilePath'), 'onJSChange', jq("#uploadPath").val()));
        }
     </script>
     ]]>
     </html>
     <div id="lFilePath">

     </div>    
 </div>

I want upload file to server Please, help me Thanks

Currently the above code, I have call handling and get filenames file FileUploadController.java

@Command
@Listen("onJSChange=#lFilePath")
public void onJSChange(Event event) {
    System.out.println(event.getData());
}
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0
link publish delete flag offensive edit
0

answered 2015-07-06 02:14:24 +0800

HuySeven gravatar image HuySeven
1 1

Thank you Darksu, But I want to upload by Zul file as I described

link publish delete flag offensive edit

Comments

You can use button component on zul page with upload feature enabled, and listen to onUpload event.

vincentjian ( 2015-08-13 09:03:26 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-07-01 13:55:48 +0800

Seen: 34 times

Last updated: Jul 06 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More