Later, a friend recommended an upload plug-in called uploadify. It seemed to be very good, so I downloaded a sample from the official website and ran it. It felt very good. I just beautified it a little and it was OK...!
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; namespace WebApplication2 { public partial class Upload : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { HttpPostedFile file = Request.Files["FileData"]; string uploadpath = Server.MapPath(Request["folder"] "\"); if (file != null) { if (!Directory.Exists(uploadpath)) { Directory.CreateDirectory(uploadpath); } file.SaveAs(uploadpath file.FileName); Response.Write("1"); } else { Response.Write("0"); } } } }
D.upload这个文件加也是必需 3.运行结果:
4.最后说说:这个只是一个简单的入门例子,至于界面可以根据自己的需要去改
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn