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程序在编译的过程中,有一个特点是这样的,不管是项目中的类,还是标准库或者第三方库的类,编译的时候只会把用到的那些类文件编译进去,也就是说,某一些类,只要没有被主程序引用到,那这个文件是不会被编译 ...
随机推荐
- 隐式intent启动电子邮件,不需要非电子邮件应用程序。
Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.put ...
- ssh The authenticity of host 192.168.0.xxx can't be established
用ssh登录一个机器(换过ip地址),提示输入yes后,屏幕不断出现y,只有按ctrl + c结束 错误是:The authenticity of host 192.168.0.xxx can't b ...
- JS的className,字体放大缩小
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- Lucene4.X 高级应用
Lucene 简介以及使用 Lucene, 一个基于 Java 的开源的全文搜索工具包,可以方便的嵌入到各种应用系统中,实现针对应用的全文索引以及检索功能.目前是 Apache jakarta 项目 ...
- POJ 3419 Difference Is Beautiful(RMQ+二分 或者 模拟)
Difference Is Beautiful Time Limit:5000MS Memory Limit:65536KB 64bit IO Format:%lld & %l ...
- java abstract类和abstract方法
Example5_12.java abstract class A { abstract int add(int x,int y); int sub(int x,int y) { return x-y ...
- 编译Android各种错误
第一次编译成功,第二次出现Value for 'keystore' is not valid. It must resolve to a single path 打开proj.android\ant. ...
- 最简单的epoll的使用范例 : 监听 标准输入 ,并将数据回显到终端
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/epoll.h> # ...
- HDU1372,BFS象棋马走日
简单的对于bfs的运用,但是还是写的太慢了写了TMD的1H,主要是不熟悉,以后慢慢熟悉就好了,模型基本已经能建立了,主要出现bug是在方向数组的运用上面,一定要记得是从0开始的,而不是从1开始的,导致 ...
- 【转】bootstrap 的 affix.js 插件
我觉得 Twitter Bootstrap 提供的 JavaScript 插件可用性非常高,但文档多数简单.按部就班操作了,有效果当然好,没效果的话简直不知道为什么.之前我写过 Scrollspy 用 ...