Uploadify flash 上传
下载需要的文件?http://www.uploadify.com/download/ ,千万别忘了 jquery 文件 html: <html><head runat="server"> ? ? <title></title>? ? <link href="js/uploadify/uploadify.css" rel="stylesheet" type="text/css" /> ? ? <script src="js/jquery-1.4.1.js" type="text/javascript"></script> ? ? <script src="js/uploadify/jquery.uploadify-3.1.js" type="text/javascript"></script> <!-- uploadify某.某版本js--> ?<script type="text/javascript"> ? ? ? ? $(function () { ? ? ? ? ? ? $("#uploadify").uploadify({ ? ? ? ? ? ? ? ? //指定swf文件 ? ? ? ? ? ? ? ? 'swf': 'js/uploadify/uploadify.swf', ? ? ? ? ? ? ? ? //后台处理的页面 ? ? ? ? ? ? ? ? 'uploader': 'UploadHandler.ashx', ? ? ? ? ? ? ? ? //按钮显示的文字 ? ? ? ? ? ? ? ? 'buttonText': '上传图片', ? ? ? ? ? ? ? ? //显示的高度和宽度,默认 height 30;width 120 ? ? ? ? ? ? ? ? //'height': 15, ? ? ? ? ? ? ? ? //'width': 80, ? ? ? ? ? ? ? ? //上传文件的类型 ?默认为所有文件 ? ?'All Files' ?; ?'*.*' ? ? ? ? ? ? ? ? //在浏览窗口底部的文件类型下拉菜单中显示的文本 ? ? ? ? ? ? ? ? 'fileTypeDesc': 'Image Files', ? ? ? ? ? ? ? ? //允许上传的文件后缀 ? ? ? ? ? ? ? ? 'fileTypeExts': '*.gif; *.jpg; *.png', ? ? ? ? ? ? ? ? //发送给后台的其他参数通过formData指定 ? ? ? ? ? ? ? ? //'formData': { 'someKey': 'someValue','someOtherKey': 1 }, ? ? ? ? ? ? ? ? //上传文件页面中,你想要用来作为文件队列的元素的id,默认为false ?自动生成,?不带# ? ? ? ? ? ? ? ? //'queueID': 'fileQueue', ? ? ? ? ? ? ? ? //选择文件后自动上传 ? ? ? ? ? ? ? ? 'auto': true, ? ? ? ? ? ? ? ? //设置为true将允许多文件上传 ? ? ? ? ? ? ? ? 'multi': true ? ? ? ? ? ? }); ? ? ? ? }); ? ?? ? ? </script> </head> <body> ? ? <div> ? ? ? ? <%--用来作为文件队列区域--%> ? ? ? ? <div id="fileQueue"> ? ? ? ? </div> ? ? ? ? <input type="file" name="uploadify" id="uploadify" /> ? ? ? ? <p> ? ? ? ? ? ? <a href="javascript:$('#uploadify').uploadify('upload')">上传</a>|? ? ? ? ? ? ? <a href="javascript:$('#uploadify').uploadify('cancel')">取消上传</a> ? ? ? ? </p> ? ? </div> </body> </html> 一般处理程序: public void ProcessRequest(HttpContext context) 假如你上传的文件太大,在一般处理程序会报错。上传文件超时,需要在web.config文件中加入 主要设置: <httpRuntime executionTimeout="90" maxRequestLength="800000" /> 全部设置: <httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" /> 这样之后就可以搞定了 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |