zoukankan
html css js c++ java
Input控件上传文件
<%@ 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> <title></title> </head> <body> <form action="exec/Upload.ashx" enctype="multipart/form-data" method="post"> <input name="file" type="file" /> <input type="submit" value="提交" /> </form> </body> </html>
页面1里面写这些
<%@ WebHandler Language="C#" Class="Upload" %> using System; using System.Web; public class Upload : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; HttpFileCollection imgs = context.Request.Files; if (imgs.Count>0) { for (int i = 0; i < imgs.Count; i++) { if (imgs[i].ContentLength!=0) { string oldName=imgs[i].FileName.ToString(); string imgName = Guid.NewGuid().ToString(); string imgType = oldName.ToString().Substring(oldName.LastIndexOf(".")); string imgPath = "~/upload/" + imgName + imgType; imgs[i].SaveAs(context.Server.MapPath(imgPath)); } } } } public bool IsReusable { get { return false; } } }
一般处理程序代码
点击下载源代码
查看全文
相关阅读:
实验5 编写调试有多个段的程序
实验四 [bx]和 loop 的使用
实验三
实验二
第一章
汇编语言第二章知识梳理
实验一:查看CPU和内存,用机器指令和汇编指令编程
实验9
实验5
实验4:
原文地址:https://www.cnblogs.com/javawebsoa/p/2458006.html
最新文章
第三章知识梳理
《汇编语言》第二章知识梳理
《汇编语言》实验一:用机器指令和汇编指令编程
《汇编语言》第一章知识梳理
ubuntu安装pip
SQLMAP简单使用方法
第5~8章知识汇总
Myeclipse界面(控件)
关于MyEclipse连接SQLServer和Mariadbsql
实验九 根据材料编程
热门文章
实验五 编写、调试具有多个段的程序
实验四 [BX]和loop的使用
汇编语言 第四章 第一个程序
实验三 编程,编译,连接,跟踪
实验二 用机器指令和汇编指令编程
汇编语言 第三章 寄存器(内存访问)
汇编语言 第二章 寄存器
实验一 查看CPU和内存,使用机器指令和汇编指令编程
汇编语言 第一章 基础知识
实验九 根据材料编程
Copyright © 2011-2022 走看看