上传视频在struts 2 [英] Upload video in struts 2
问题描述
我想在我的struts 2 web应用程序中上传视频。为此,我正在使用文件上传拦截器。我的问题是,我能够成功上传图像和文本文件,但不能够视频和Flash文件,文件参数不会得到我的行动初始化。我在做以下的方式:
在struts.xml中的条目:
< action name =uploadFile
class =com.infoshore.noticeboard.actions.DssUploadFileActionmethod =addUploadContent>
< interceptor-ref name =fileUpload>
< param name =allowedTypes>
image / png,image / gif,image / jpeg,image / pjpeg,image / jpg,video / x-ms-rmvb,video / x-ms-wmv,video / x-ms-avi,
video / fli,video / x-fli,video / x-atomic3d-feature,video / gl,video / x-gl,video / x-isvideo,video / mpeg,video / x-motion-jpeg,video / quicktime,video / x-sgi-movie,
video / x-mpeg,video / vnd.rn-realvideo,video / x-scm
< / param>
<! - < param name =allowedTypes> text / plain< / param> - >
< param name =maximumSize> 10485760< / param>
< / interceptor-ref>
< interceptor-ref name =logininterceptor/>
< interceptor-ref name =params/>
< interceptor-ref name =basicStack/>
< result name =successtype =chain> dssUploadContent< / result>
< result name =inputtype =chain> dssUploadContent< / result>
< result name =login> login.jsp< / result>
< / action>
我在这里做什么错,请告诉我。
Thanks。
默认值为 2097152字节 b 为每个请求,全局配置为 ; 默认值为 2097152 bytes (2 MB)(源文件上传高级配置) 通过混合这两个参数,您可以在单个请求中上传N个 I want to upload video in my struts 2 web application. For this I am using File upload interceptor . My problem is that, I am able to upload image and text file successfully, but not able to video and flash files, file parameters are not get initialize in my action. I am doing in the following way: entry in struts.xml : What wrong I am doing here, please tell me.
Thanks. The maximumSize is per-file, configured globally OR per-Action The default is 2097152 bytes (2 MB) The multipart.maxSize is per-request, configured only globally; The default is 2097152 bytes (2 MB) (source on File Upload Advanced Configuration) Mixing this two parameters allows you to upload N files of 这篇关于上传视频在struts 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!< interceptor-ref name =fileUpload>
< param name =maximumSize> 10485760< / param>
< / interceptor-ref>
$
< constant name =struts.multipart.maxSizevalue =100485760/>
maximumSize
MB文件,如果它们不打破 struts.multipart.maxSize
MB定义的限制。 更多信息
<action name="uploadFile"
class="com.infoshore.noticeboard.actions.DssUploadFileAction" method="addUploadContent">
<interceptor-ref name="fileUpload">
<param name="allowedTypes">
image/png,image/gif,image/jpeg,image/pjpeg,image/jpg,video/x-ms-rmvb,video/x-ms-wmv,video/x-ms-avi,
video/fli,video/x-fli,video/x-atomic3d-feature,video/gl,video/x-gl,video/x-isvideo,video/mpeg,video/x-motion-jpeg,video/quicktime,video/x-sgi-movie,
video/x-mpeg,video/vnd.rn-realvideo,video/x-scm
</param>
<!-- <param name="allowedTypes">text/plain</param> -->
<param name="maximumSize">10485760</param>
</interceptor-ref>
<interceptor-ref name="logininterceptor" />
<interceptor-ref name="params" />
<interceptor-ref name="basicStack" />
<result name="success" type="chain">dssUploadContent</result>
<result name="input" type="chain">dssUploadContent</result>
<result name="login">login.jsp</result>
</action>
<interceptor-ref name="fileUpload">
<param name="maximumSize">10485760</param>
</interceptor-ref>
<constant name="struts.multipart.maxSize" value="100485760" />
maximumSize
MB each one in a single request, if they do not break the struts.multipart.maxSize
MB defined limit.