Demo code
<script type="text/javascript" src="jQueryAjaxUpload.js"></script>
<form method="post" action="" enctype="multipart/form-data" id="example_form">
<input type="file" name="file"/>
<input type="submit"/></form>
<script>
post :
function (){
alert('posted');
},
complete :
function() {
alert('Upload complete');
}
});
</script> In case of using spring add below bean to spring beans
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="1000000"/>
</bean>Follow the below link to download jQueryAjaxUpload.js file
http://www.jainaewen.com/files/javascript/jquery/iframe-post-form.html
No comments:
Post a Comment