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. 3_for循环的拓展应用

    HTML代码: <input type="button" value="1"/> <input type="button" ...

  2. MVVM 在使用 ItemsSource 之前,项集合必须为空

    今天在做ListBox和Combobox绑定的时候,都出现过“在使用 ItemsSource 之前,项集合必须为空”的错误. Combobox比较简单,代码如下: <ComboBox x:Nam ...

  3. 神经网络hopfield的学习

    Hopfield神经网络使用说明. 该神经网络有两个特点: 1,输出值只有0,1 2,Hopfield没有输入(input) 这里解释一下第二个特点,什么叫没有输入?因为在使用Hopfield网络的时 ...

  4. thinkphp学习笔记(一)

    一.入门与安装 1.进入C:\Windows\System32\drivers\etc的hosts文件中增加127.0.0.1 www.tp5.com 即访问这个域名就相当于访问127.0.0.1 2 ...

  5. linux启动流程

    看了深入理解linux内核一书的最后对linux启动流程的介绍,下面就把我能理解的写一下吧: bios(硬件加电自检POST,寻找第一个启动设备) the boot loader(可以从硬盘启动也可以 ...

  6. java中类型转换

    1.基本数据类型转换    char, byte,short,int,long,float,double,boolean (1)小类型数据可以直接赋给大类型数据          例:char a=' ...

  7. 原来在linux上切换jdk的版本是这么简单

    上次在linux上切换jdk版本的时候,还配置了半天的环境变量,今天又查了一下,原来是这么的简单 1. 查看相应的jdk是否在 ubuntu的jdk菜单里,查看: (输全哦) update-alter ...

  8. JAVA使用POI操作excel

    文中处理的excel是2003年以前的版本,使用HSSFworkbook,如果处理2007版本以后的excel,用XSSFworkbook,对于二者的兼容性问题,可参考 http://blog.csd ...

  9. 【String与基本类型之间的转换】以及【进制转换】

    1. 基本数据类型---->字符串类型: 方法一:使用连接一个空字符串,例如  基本数据类型+“” : 方法二:静态方法 String.valueOf(),具体有: String.valueOf ...

  10. td标签内的内容过长导致的问题的解决办法

    问题描述:在开发过程中,td标签中的有一个cell格中的内容过长,导致td标签高度增加,从而导致整个页面内容的不协调: