- 注册时间
- 2012-7-6
- 最后登录
- 2012-7-20
- 阅读权限
- 10
- 积分
- 48
- 精华
- 0
- 帖子
- 15
|
本帖最后由 dodo 于 2012-7-20 10:01 编辑
代码如下:
<input id="fileupload1" class="mini-fileupload" name="Fdata" limittype="*.gif;*.rar;" flashUrl="../swfupload/swfupload.swf"
uploadUrl="upload.aspx" />
<br />
<input type="button" value="上传" />
upload代码:
string tempFile = Request.PhysicalApplicationPath;
//找到目标文件对象
HttpPostedFile uploadFile = Request.Files["Fdata"];
string userFilePath = "fileUpload\\" + Session["UserName"].ToString() + "\\";
// 如果有文件, 则保存到一个地址
if (uploadFile.ContentLength > 0)
{
uploadFile.SaveAs(string.Format("{0}{1}{2}", tempFile, userFilePath, uploadFile.FileName));
}
Response.Write(uploadFile.FileName + "(" + DateTime.Now + ")");
|
|