SlickUpload Upload to disk
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的更多相关文章
- hadoop配置文件详解系列(一)-core-site.xml篇
接上一个属性,这个属性就是设置阈值的. hadoop.security.groups.cache.secs 300 配置用户组映射缓存时间的,当过期时重新获取并缓存. hadoop.security. ...
- 发布新的模型类包(用于上传到 NuGet 服务器上)
生成包文件: 1.修改了模型类之后,在项目上点击右键,在列表菜单中选择 “编辑 …….csproj”,然后将里面的三个版本号都换成新的版本号. 2.右键项目,点击“打包” 3.复制输出信息中生成的包的 ...
- upload&&download
package am.demo; import java.io.File; import java.io.IOException; import java.util.Iterator; imp ...
- jQuery File Upload 单页面多实例的实现
jQuery File Upload 的 GitHub 地址:https://github.com/blueimp/jQuery-File-Upload 插件描述:jQuery File Upload ...
- SlickUpload 发布到IIS后报错
开发时候采用slickupload控件都没问题,项目发布到IIS时发生了错误: Could not contact SlickUpload request progress handler at /S ...
- SlickUpload Quick Start Guide
Quick Start Guide The SlickUpload quick start demonstrates how to install SlickUpload in a new or ex ...
- Servlet - Upload、Download、Async、动态注册
Servlet 标签 : Java与Web Upload-上传 随着3.0版本的发布,文件上传终于成为Servlet规范的一项内置特性,不再依赖于像Commons FileUpload之类组件,因此在 ...
- upload三种上传方式(上)---Servlet---post---commons-fileupload.1.2.1.jar方式请求上传文件
上传前进行的配置选项: 1.在下方的Servers中,右键你的tomcat--open,选中下面两个配置. 第一个:Serve modules without publishing 作用:tomcat ...
- common upload乱码
request.setCheracterEncoding("utf-8"); DiskFileUpload.setHeaderEncoding("utf-8") ...
随机推荐
- Nessus导入Cookie进行Web应用安全扫描
在不导入Cookie使用Nessus进行扫描的时候,扫描的结果是比较简单的,很多深层的问题无法被扫描出来. 需要我们手动导入Cookie,带着Cookie的状态扫描的结果会更详细更深入,以下是操作步骤 ...
- MATLAB cvx 工具包使用
一个例子 m = ; n = ; p = ; A = randn(m,n); b = randn(m,); C = randn(p,n); d = randn(p,); e = rand; cvx_b ...
- Spring 学习笔记 2. 尚硅谷_佟刚_Spring_IOC&DI概述
1,远古时代 这里讲述的IOC的演变历史,举一个例子,假如需要生成HTML和PDF格式的报表,以前的开发方式就是有个报表服务类需要使用报表生成器 它需要和其他三个都关联,它既需要知道接口类型,也需要知 ...
- svn 版本库的创建和配置
1.创建SVN版本库 mkdir trunk svnadmin create /root/trunk/svntest #这里是路径和即将创建的版本库名称 2.配置svn cd /root/trunk/ ...
- 使用 xcode 8 构建版本 iTunes Connect 获取不到应用程序的状态的解决办法
Archive生成Release版本的ipa并将其提交到iTunesConnect,上传成功后我打开iTunesConnect网站登录我的开发账号,准备提交版本更新,然而我却找不到 ...
- EasyUI需注意的问题01
一.EasyUI-Datagrid分页 在创建数据表格(DataGrid)的时候,通过设置'pagination' 属性为 true,可以在数据表格的底部生成一个分页工具栏. <table id ...
- JAVAWEB学习
http://www.cnblogs.com/xdp-gacl/p/3744053.html JavaWeb学习总结(三)——Tomcat服务器学习和使用(二)
- 由XML解析学习工厂模式
代码段1: startupData = new StartupData(); /* 设定自定义的MyHandler给XMLReader */ StartupXMLHandler startupData ...
- Await, and UI, and deadlocks! Oh my!
It’s been awesome seeing the level of interest developers have had for the Async CTP and how much us ...
- STL练习题
//hdu_2717 //map 一对多映射,基于关键字快速查找,不允许重复值 //queue 队列 先进先出 #include<iostream> #include<cstdio& ...