使用实例:
private string urlPath = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
urlPath = Server.MapPath("~/file/");
fileInfo();
}
}
/// <summary>
/// 文件操作
/// </summary>
使用实例:
private string urlPath = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
urlPath = Server.MapPath("~/file/");
fileInfo();
}
}
/// <summary>
/// 文件操作
/// </summary>
使用html或aspx建立一个上传页面,再实用jquery进行图片或文件上传
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 id="Head1" runat="server">
<title>Porschev--Asp.Net 使用Jquery和一般处理程序实现无刷新上传大文件</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<div class="carea">
<div class="ui-tabs-panel">
<div class="search_head">
<h3 class="sh_title">
Porschev--Asp.Net 使用Jquery和一般处理程序实现无刷新上传大文件</h3>
</div>
<ul class="info_input">
<li><b>选择文件:</b>
<div class="ii_conarea">
<input id="fulFile" name="fulFile" type="file" class="ful" />
<img id="imgUploading" src="images/uploading.gif" alt="正在上传..." class="loading_img none" />
</div>
</li>
</ul>
<input id="btnSubmit" type="button" value="上传" class="btn_sub" />
</div>
</div>
</form>
</body>
</html>
网上很多种上传图片的实例,再不使用aspx控件的时候可以使用html的input的file控件:<input id="imgfile" name="imgfile" type="file" />
使用aspx或html建立需要上传文件的页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<input type="file" accept="application/msword"><br><br>accept属性列表<br>