The file upload stream provider is a built-in SlickUpload provider that uses the filesystem for uploaded file storage. Using this provider, SlickUpload can store files to any location your ASP.NET application has access to, including paths inside the application, other paths on the same server, or a seperate server via a UNC path to a file share.

Configuration

To use the file provider, set the type="File" attribute on the uploadStreamProvider web.config key. The following settings allow you to customize the filename and location where the files will be stored:

1
<uploadStreamProvider type="File" />

If you want more control over the storage location, you can inherit from theFileUploadStreamProvider class to create your own custom file based upload stream provider.

Attributes

location – Optional String attribute
Specifies the root storage location. This can be an absolute path (c:\folder), an app relative path (~/folder), or a UNC path (\\server\folder).

NOTE: The user ASP.NET is running under (by default ASPNET for XP and IIS_WPG for Windows 2003 and later) must have write access to the specified path.

existingAction – Optional ExistingAction attribute
Specifies the action to take when trying to upload to a file that exists.
Exception
Throw an exception and cancel the upload.
Overwrite
Overwrite the existing file
Rename
Rename the new file using a rename sequence to find the first unused filename. The builtin sequence starts with the desired filename, then iterates a number N starting with 1 and appends [N] to the filename until it finds a free filename.

You can customize the rename sequence by creating a class that inherits fromFileUploadStreamProvider and overriding the GetRenameSequence method, returning a new sequence generator for your desired renaming sequence.

Default: Exception

fileNameMethod – Optional FileNameMethod attribute
Specifies the method to use to generate a filename. Possible values:
Client
Use the client filename as the server filename.
Guid
Use a unique GUID as the server filename.

Default: Client

Controlling the filename during upload

To control the filename used during the upload, you can use one of the three file name generation methods defined above: Client or Guid.

If you want to generate your own filename (including path if you desire), you can create a class that inherits from FileUploadStreamProvider and override the GetServerFileNamemethod. For an example of this, look at the CustomFileName sample. You can also override other methods of the FileUploadStreamProvider class to do more customization, such as a custom rename sequence.

Retrieving the server filename

After the upload you can get the server filename a file was written using theUploadedFile.ServerLocation property.

SlickUpload Upload to disk的更多相关文章

  1. hadoop配置文件详解系列(一)-core-site.xml篇

    接上一个属性,这个属性就是设置阈值的. hadoop.security.groups.cache.secs 300 配置用户组映射缓存时间的,当过期时重新获取并缓存. hadoop.security. ...

  2. 发布新的模型类包(用于上传到 NuGet 服务器上)

    生成包文件: 1.修改了模型类之后,在项目上点击右键,在列表菜单中选择 “编辑 …….csproj”,然后将里面的三个版本号都换成新的版本号. 2.右键项目,点击“打包” 3.复制输出信息中生成的包的 ...

  3. upload&&download

    package am.demo;  import java.io.File;  import java.io.IOException;  import java.util.Iterator;  imp ...

  4. jQuery File Upload 单页面多实例的实现

    jQuery File Upload 的 GitHub 地址:https://github.com/blueimp/jQuery-File-Upload 插件描述:jQuery File Upload ...

  5. SlickUpload 发布到IIS后报错

    开发时候采用slickupload控件都没问题,项目发布到IIS时发生了错误: Could not contact SlickUpload request progress handler at /S ...

  6. SlickUpload Quick Start Guide

    Quick Start Guide The SlickUpload quick start demonstrates how to install SlickUpload in a new or ex ...

  7. Servlet - Upload、Download、Async、动态注册

    Servlet 标签 : Java与Web Upload-上传 随着3.0版本的发布,文件上传终于成为Servlet规范的一项内置特性,不再依赖于像Commons FileUpload之类组件,因此在 ...

  8. upload三种上传方式(上)---Servlet---post---commons-fileupload.1.2.1.jar方式请求上传文件

    上传前进行的配置选项: 1.在下方的Servers中,右键你的tomcat--open,选中下面两个配置. 第一个:Serve modules without publishing 作用:tomcat ...

  9. common upload乱码

    request.setCheracterEncoding("utf-8"); DiskFileUpload.setHeaderEncoding("utf-8") ...

随机推荐

  1. 安卓稳定性压测工具_monkey环境搭建(简易)

    1.准备工具: sdk(64位操作系统):http://pan.baidu.com/s/1kV33pll sdk(32位操作系统):http://pan.baidu.com/s/1gfnww87 2. ...

  2. awk用法总结笔记

    +  : 匹配1或多次出现的字符或正则表达式  awk '/col+/' testfile ?  : 匹配0或1次出现的字符或正则表达式    awk '/col+/' testfile |  : 匹 ...

  3. CMM能力成熟度模型

    CMM把软件企业的过程管理能力划分为5个等级: 1  .初始级:个别的.混乱无序的过程,软件缺乏定义,项目的成功严重依赖于某几个关键人员的努力.软件质量由个人的开发经验来保障. 2.可重复级 实施了基 ...

  4. 文本框如果不输入任何内容提交过后是一个空字符串还是null

    1.在表单不填就提交的情况下,text类型和textarea类型的表单域,提交到服务端为空 2.checkbox.readio.select等表单域在为不填情况下不会提交到服务器,也就是说服务器接收不 ...

  5. H 1022 Train Problem Ⅰ

    题意:给我们两个序列,看能否通过压栈,出栈将第一个序列转换成第二个. 思路:将序列 1 依次压栈,同时看是否和序列 2 当前元素相同 代码如下: #include<iostream> #i ...

  6. NPIO 导出记录

    http://www.cnblogs.com/qingyuan/archive/2012/11/08/2760034.html http://www.cnblogs.com/gaoshuai/arch ...

  7. JavaScript 基础第三天

    一.前言 在前天的内容我们提到了有关于JS的一些语言结构,这些语言结构都是语法中最为基本的内容必须予以熟记并可以灵活掌握. 二.引入 在今天内容中我们将讨论两个很重要的概念,数组与函数. 三.重点内容 ...

  8. HTML5实战1

    第一章 1.搭建环境,wamp 2.检查浏览器是否支持html5 ,是否支持新标签<canvas></canvas> 3.简单高效,少用id,多用标签. 4.使用css3美化样 ...

  9. 'sessionFactory' or 'hibernateTemplate' is required解决方法

    这种情况就是在通过spring配置hibernate4的时候(注意,这里是hibernate4不是hibernate3,hibernate3的),使用的是HibernateDaoSupport的这种方 ...

  10. go json null字段的转换

    最近试了试go中对json null字段进行转换,代码如下: struct 转 json: package main import ( "encoding/json" " ...