欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp.net web大文件上传带进度条实例代码

程序员文章站 2022-09-06 22:26:11
复制代码 代码如下:using system; using system.data; using system.configuration; using system.co...
复制代码 代码如下:

using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
using system.io;
using system.collections.generic;
using system.web.configuration;

public partial class upload : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
try
{
// get the data
httppostedfile jpeg_image_upload = request.files["filedata"];

jpeg_image_upload.saveas(system.web.httpcontext.current.server.mappath("~/upload/") + jpeg_image_upload.filename);

response.statuscode = 200;
response.write("文件处理完毕!");
}
catch
{
// if any kind of error occurs return a 500 internal server error
response.statuscode = 500;
response.write("未知错误!");
}
finally
{
// clean up
response.end();
}

}
}

打包源码下载