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; } } }
一般处理程序代码
点击下载源代码
查看全文
相关阅读:
docker-dockerfile构建与部署nginx
淘宝镜像安装
css3 中的变量 var 的使用
CSS样式清除
css 样式初始化(rem兼容)
canvas截屏网页为图片下载到本地-html2canvas.js
移除JSON对象中的某个属性
js 常用方法集合(持续更新)
小程序获取上个页面vm对象 解决百度小程序返回上一页不更新onShow更新(适用于uni-app)
小程序 请求Promise简单封装
原文地址:https://www.cnblogs.com/javawebsoa/p/2458006.html
最新文章
python-pycharm windows安装
docker compose一键部署lnmt环境
docker compose 一键部署LNMP环境
docker compose常用命令
docker compose安装
docker compose概述
docker上传镜像到harbor镜像仓库
docker-harbor的https部署
docker-harbor安装与部署
docker-harbor概述
热门文章
docker-图形化-portainer管理多台docker主机
docker-图形化-Portainer部署与使用
docker-图形化-Portainer概述
docker-编写dockerfile最佳实践
docker-dockerfile构建与部署微服务jar包
docker-dockerfile构建与部署tomcat
docker-容器实现核心技术:CGroups
docker-容器实现核心技术:Namespace
docker-lnmp环境容器化搭建个人博客系统
docker-dockerfile构建与部署php
Copyright © 2011-2022 走看看