上传视频在struts 2 [英] Upload video in struts 2

查看:178
本文介绍了上传视频在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。

解决方案

strong> per-file ,配置为全局每个操作 < interceptor-ref name =fileUpload>
< param name =maximumSize> 10485760< / param>
< / interceptor-ref>

默认值为 2097152字节 b
$ .maxSize

< constant name =struts.multipart.maxSizevalue =100485760/>

每个请求,全局配置为 ;

默认值为 2097152 bytes (2 MB)(源文件上传高级配置






通过混合这两个参数,您可以在单个请求中上传N个 maximumSize MB文件,如果它们不打破 struts.multipart.maxSize MB定义的限制。 更多信息


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 :

<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>

What wrong I am doing here, please tell me. Thanks.

解决方案

The maximumSize is per-file, configured globally OR per-Action

<interceptor-ref name="fileUpload">
    <param name="maximumSize">10485760</param>
</interceptor-ref>

The default is 2097152 bytes (2 MB)

The multipart.maxSize

<constant name="struts.multipart.maxSize" value="100485760" />

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 maximumSize MB each one in a single request, if they do not break the struts.multipart.maxSize MB defined limit.

More info here

这篇关于上传视频在struts 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆