用fileUpload上傳視頻文件就出現找不到服務器錯誤,或者連接被重置
載入頁面時到服務器的連接被重置。
* 此站點暫時不可用或者太忙。請稍後重試。
* 如果您無法載入任何頁面,請檢查您計算機的網絡連接。
* 如果您的計算機受到防火牆或代理服務器的保護,請確認 Firefox 被授權訪問網頁。
等錯誤。
解決方法:在Web.Config配置文件中的system.web節里加上:
<httpRuntime maxRequestLength="2097151" executionTimeout="60"/>
如果上傳的文件,大於2097151KB它還是會出現第二個錯誤!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PreviewImageInFileUpload.aspx.cs" Inherits="PreviewImageInFileUpload" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Preview Image In FileUpload</title> <%--CSS--%> <style type="text/css"> #newPreview{ FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale) } </style> </head> <body> <%--JavaScript--%> <script language="javascript" type="text/javascript"> function PreviewImg(imgFile) { var newPreview = document.getElementById("newPreview"); newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value; newPreview.style.width = "80px"; newPreview.style.height = "60px"; } </script> <form id="form1" runat="server"> <div> <%--添加onchange事件--%> <asp:FileUpload ID="FileUpload1" runat="server" onchange="PreviewImg(this)" /> </div> <%--建立一個div來存放預覽--%> <div id="newPreview"></div> </form> </body> </html> 轉自:http://hi.baidu.com/cooll87/blog/item/e014050e0572f9236059f38b.html |