Sunday, 15 August 2010

changing uploaded file in JSP through JavaScript -


Can anyone give me the proper example to change the uploaded file in JSP?

This is my JSP page code

  & lt; Div class = "action" & gt; & Lt; Input type = "file" name = "files [0]" id = "file0" style = "float: left" required & gt; & Lt; Input type = "button" id = "btn zoom in" value = "+" style = "float: left" & gt; & Lt; Input type = "button" id = "btn zoomout" value = "-" style = "float: left" & gt; & Lt; Input type = "button" id = "btnCrop" value = "crop" style = "float: left" & gt; & Lt; Input type = "submit" value = "upload file" style = "float: true" /> & Lt; / Div & gt; & Lt; Div class = "crop" & gt; & Lt; / Div & gt; I'm cutting the uploaded image using JS and CSS ...  

JS

/ P>

 < Code> document.querySelector ('# btnCrop'). AddEventListener ('click', function) {var img = cropper.getDataURL (); Document.query selector ('cropped'). InnerHTML = '& lt; Img name = "img123" src = "'+ img +'" & gt; ';})  

This

 cropper.getDataURL () 
will provide me the crop Image but now I am unable to set the file to upload this image such as file0 or file [0] to pass in my servlet, how can I do this?


No comments:

Post a Comment