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") ...
随机推荐
- STAF no JSTAF in java.library.path 的终极解决办法
最近两天在研究利用STAF 实现程序更新包的自动部署测试.运行Demo代码时遇到一个坑.我的安装路径是默认的.C:\STAF\samples\demo在命令行窗口用执行命令:java STAFDemo ...
- UICollectionView(集合视图)以及自定义集合视图
一.UICollectionView集合视图 其继承自UIScrollView. UICollectionView类是iOS6新引进的API,用于展示集合视图,布局 ...
- HTML5-列表的使用
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- HTML5-链接
链接:外部,图片,内部 <!DOCTYPE html> <html> <head lang="en"> <meta charset=&qu ...
- entityframework使用oracle的几个小问题
问题一:Operation is not valid due to the current state of the object 生成的edmx文件有问题,解决方法参考链接 问题二:InvalidO ...
- MVC与DWZ整合中部分问题的解决
1.错误提示距离太远 2.正确与错误时返回JSON(即:如何不出现打开新页显示JSON字串) 3.打开新页后“数据加载中,请稍候”关不掉 4.如何正常的分页,同时如果有查询结果时分页也要有效 5.关闭 ...
- .Net Core CLI在CentOS7的安装及使用简介
1. 安装libunwind cd /usr/local/src wget http://download.savannah.gnu.org/releases/libunwind/libunwind- ...
- [.NET领域驱动设计实战系列]专题十:DDD扩展内容:全面剖析CQRS模式实现
一.引言 前面介绍的所有专题都是基于经典的领域驱动实现的,然而,领域驱动除了经典的实现外,还可以基于CQRS模式来进行实现.本专题将全面剖析如何基于CQRS模式(Command Query Respo ...
- C# Entity Framework查询小技巧 NoTracking
在使用Entity Framework做查询的时候,如果只需要显示,而不用保存实体,那么可以用AsNoTracking()来获取数据. 这样可以提高查询的性能. 代码如下: var context = ...
- 用Python编写博客导出工具
用Python编写博客导出工具 罗朝辉 (http://kesalin.github.io/) CC 许可,转载请注明出处 写在前面的话 我在 github 上用 octopress 搭建了个人博 ...