mvc中上传图片到指定文件夹中
前台:
@using (Html.BeginForm("AddImg", "UpFileImg", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
<input type="submit" value="OK" />
}
one
后台:
[HttpPost]
public ActionResult AddImg(HttpPostedFileBase file)
{
if (file != null && file.ContentLength > )
{ var fileName =System.IO.Path.GetFileName(file.FileName);
var path = System.IO.Path.Combine(Server.MapPath("/img"), fileName);
file.SaveAs(path);
}
return Content("上传成功");
}
two
mvc中上传图片到指定文件夹中的更多相关文章
- 在MVC3中修改KindEditor实现上传图片到指定文件夹
KindEditor编辑器默认上传的图片文件夹,是根据系统时间自动生成的,图片是自动上传到这些文件夹里面,无法选择.如果要上传图片到指定文件夹,像相册一样管理图片,则需要扩展KindEditor编辑器 ...
- C#遍历指定文件夹中的所有文件(转)
原文链接:http://www.cnblogs.com/qianqianfy/archive/2009/07/08/1518974.html 1. C#遍历指定文件夹中的所有文件 DirectoryI ...
- C#遍历指定文件夹中的所有文件(转)
C#遍历指定文件夹中的所有文件 DirectoryInfo TheFolder=new DirectoryInfo(folderFullName);//遍历文件夹foreach(DirectoryIn ...
- php获取指定文件夹中文件名称
/** * php获取指定文件夹中文件名称 * @author jackie <2018.10.10> */ public static function getFileName($fil ...
- C# 读取指定文件夹中的全部文件,并按规则生成SQL语句!
本实例的目的在于: 1 了解怎样遍历指定文件夹中的全部文件 2 控制台怎样输入和输出数据 代码: using System; using System.IO; namespace ToSql{ cla ...
- WPF获取读取电脑指定文件夹中的指定文件的地址
//保存指定文件夹中的指定文件的地址 string List<string> mListUri = new List<string>(); //文件夹地址 string fol ...
- webpack 打包出多个HTML文件,多个js文件,图片文件放置到指定文件夹中
一.webpack.config.js简单代码 const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { ...
- C#遍历指定文件夹中的所有文件和子文件夹
参考:http://www.cnblogs.com/skylaugh/archive/2012/09/23/2698850.html DirectoryInfo TheFolder=new Direc ...
- (Python)导出指定文件夹中as文件的完全限定类名
AS3程序在编译的过程中,有一个特点是这样的,不管是项目中的类,还是标准库或者第三方库的类,编译的时候只会把用到的那些类文件编译进去,也就是说,某一些类,只要没有被主程序引用到,那这个文件是不会被编译 ...
随机推荐
- linux视频学习3(linux安装,shell,tcp/ip协议,网络配置)
linux系统的安装: 1.linux系统的安装方式三种: 1.独立安装linux系统. 2.虚拟机安装linux系统. a.安装虚拟机,基本是一路点下去. b.安装linux. c.linux 安装 ...
- 第一个python实例程序
#!/usr/bin/python2.7 import os ls = os.linesep fname = raw_input("fname:"); while True: if ...
- 使用devcon禁用启用网卡
系统平台:win2003 情况描述: 机器上装有两块网卡,8136和8139,网卡A使用静态IP,连接内部办公网,网卡B使用DHCP,连接互联网.切换两个网络时,需要先禁用一个网卡,启用另一个网卡.来 ...
- Android中的分页加载
//----------------------MainActivity中--------------------------------------------------- package com ...
- Android与路由器连接服务
界面UI: package my.work.Library; import java.util.Timer; import java.util.TimerTask; import java.util. ...
- Video Pooling
Video pooling computes video representation over the whole video by pooling all the descriptors from ...
- Node.js学习 - Function
Node.js函数和JavaScript类似 function say(word) { console.log(word); } function execute(someFunction, valu ...
- MoQ(基于.net3.5,c#3.0的mock框架)简单介绍
我们在做单元测试的时候,常常困扰于数据的持久化问题,很多情况下我们不希望单元测试影响到数据库中的内容,而且受数据库的影响有时我们的单元测试的速度会很慢,所以我们往往希望将持久化部分隔离开,做单元测试的 ...
- CF 313 DIV2 B 树状数组
http://codeforces.com/contest/313/problem/B 题目大意 给一个区间,问你这个区间里面有几个连续相同的字符. 思路: 表示个人用树状数组来写的...了解了树状数 ...
- emacs format
格式化源码是很常见的需求,emacs有个indent-region函数用于格式化选定的代码,前提是你处在某个非text mode下,如c-mode或者java-mode之类.如果要格式化整个文件,你需 ...