java - Not able to upload large files -
i upload large amount of image file (max size 10mb) using following configuration struts.xml
<interceptors> <interceptor-stack name="fileuploadstack"> <interceptor-ref name="exception" /> <interceptor-ref name="alias" /> <interceptor-ref name="servletconfig" /> <interceptor-ref name="prepare" /> <interceptor-ref name="i18n" /> <interceptor-ref name="chain" /> <interceptor-ref name="debugging" /> <interceptor-ref name="profiling" /> <interceptor-ref name="scopedmodeldriven" /> <interceptor-ref name="modeldriven" /> <interceptor-ref name="fileupload"> <param name="maximumsize">10485760</param> <param name="allowedtypes">image/jpg,image/jpeg,image/gif,image/png,image/pjpeg</param> </interceptor-ref> <interceptor-ref name="checkbox" /> <interceptor-ref name="staticparams" /> <interceptor-ref name="actionmappingparams" /> <interceptor-ref name="params"> <param name="excludeparams"> dojo\..*,^struts\..*</param> </interceptor-ref> <interceptor-ref name="conversionerror" /> <interceptor-ref name="validation"> <param name="excludemethods"> input,back,cancel,browse</param> </interceptor-ref> <interceptor-ref name="workflow"> <param name="excludemethods"> input,back,cancel,browse</param> </interceptor-ref> </interceptor-stack> </interceptors> <action name="ownmessageswithimage" class="social.action.usermessages" method="insertimage"> <result name="success">/pages/profile/usersinglemessage.jsp</result> <result name="input">/pages/errorpages/ajaxerror.jsp</result> <result name="login">/pages/pleaselogin.jsp</result> </action>
edit: jsp file code
<script type="text/javascript" src="js/jquery.form.js"></script> <form id="own_message_post" action="ownmessageswithimage" method="post"> <input id="fileupload" type="file" name="user_post_image" data-url="ownmessages" /> <textarea name="message" rows="4" cols="45" id="text_message_status" ></textarea><br> <input type="submit" value="post" id="submit_form_button" style="background:#004091;padding: 2px 20px 2px 20px;color: whitesmoke;font-weight: bold" /> </form> <script type="text/javascript"> $('#own_message_post').ajaxform(function(data) { $('#fileupload').val(""); }); </script>
i using malsup asynchronous file upload script problem is not uploading large file 10 mb. how make possible.
you should add constant configuration file allow multipart content size 10m
<constant name="struts.multipart.maxsize" value="10485760"/>
Comments
Post a Comment