Tuesday, May 21, 2013

ZK Upload a image or Image binding In MVVM Architecture

The ZUL file code for this will be
and in you View Model class you have to use this code snap..
I have used image tab only for showing a uploading image if you want to upload the image only you do not need to use the image tag in the page.
Note:- I have removed unwanted line of code so may be code will be not compile but this is a way to work with image.You can made changes in code according to your requirements.
The detail method of showInfo()

17 comments:

  1. It is really very nice.I was stuck to upload an image but your post helps me to resolve out the issue.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Thanks its just starting of ZK :)

      Delete
  2. Thank you very much. I am just wondering what tool you are using to write blog post and how you configured SyntaxHighlighter

    ReplyDelete
  3. See if this post will help you for this .http://syntaxhighlighterintegration.blogspot.in/2013/05/how-to-integrate-syntaxhighlighter-in.html

    ReplyDelete
  4. Thank you . Same question here as in ZK Forum blog.

    Only thing i am not able to get " private AImage myImage". The code shows declaration and get and set. But in the onImageUpload, you have not referred this. Then how will bind works ?

    ReplyDelete
    Replies
    1. See code is updated just see this line of code
      myImage = (AImage) media;
      It will bind with your image tag of ZUL

      Delete
  5. How to create dynamic download link to download file after some time link will be expire.

    ReplyDelete
    Replies
    1. Question is not clear to me if you want download link will be expire for some time then there will be plenty of way like you can use sessionid and check that session id if session id valid then download will possible otherwise it will expire the link and send message to use

      Delete
  6. in which api showInfo method is defined?I am getting error.

    ReplyDelete
    Replies
    1. showInfo method is customize method but you can use Messagebox("hello");

      Delete
  7. thanks for reply.My requirement is to upload the image to my application and save it to certain location on the disk or server and this location should be referred in database.I searched on the forum and web,I couldn't find?can you please help me?
    Also I am totally new in zk.will you please suggest me good resources to learn zk?

    ReplyDelete
    Replies
    1. After upload file you can save the file in byte array then you can get database specified path then write this path.

      Delete
  8. showInfo method is customize method but you can use Messagebox("hello");

    ReplyDelete
  9. hello, could you help me, im currently using MVC pattern, and.. i got stuck on this line
    Object objUploadEvent = ctx.getTriggerEvent();

    i dont know how to get this BindContext ctx in mvc,

    pls help

    ReplyDelete
    Replies
    1. Hi Are you looking something this example http://zkframeworkhint.blogspot.in/2013/09/zk-mvc-upload-example.html

      Delete