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. 猿团YTFCloud生态系统,全面服务创业者

    9月15日,YTFCloud已正式开启了内测. 创业者翘首以待的YTFCloud,虽然让部分创业者感受到了它的神奇,但对于更多暂时无法尝试的创业者来说,它依然有一层神秘的面纱. 今天小编就来带你近距离 ...

  2. BNUOJ 51279[组队活动 Large](cdq分治+FFT)

    传送门 大意:ACM校队一共有n名队员,从1到n标号,现在n名队员要组成若干支队伍,每支队伍至多有m名队员,求一共有多少种不同的组队方案.两个组队方案被视为不同的,当且仅当存在至少一名队员在两种方案中 ...

  3. 剑指offer算法_位运算求和

    不用+,-,*,/运算求和,可以分成三步: 1.计算两个数字的异或值,相当于只计算每一位的和,不计算进位,得出结果sum: 2.计算两个数字的与值,相当于求出两个数字的进位,然后左移一位,相当于进位, ...

  4. maven 简介

    本书代码下载 大家可以从我的网站下载本书的代码:http://www.juvenxu.com/mvn-in-action/,也可以通过我的网站与我取得联系,欢迎大家与我交流任何关于本书的问题和关于Ma ...

  5. seajs模块化作用理解(一句话)

    seajs是js模块化的工具,主要大文件js不方便其他人理解,加载也较慢,seajs把各个功能模块分开,方便平行化开发,同时易于修改和理解,不用重复写功能需要时就应用 (有什么错误,请指正,缺少多谢补 ...

  6. 关于windows phone教务在线客户端

    本人是个大二学生,由于学校的教务在线一直没出windows phone的教务在线,而且本身也对wp开发感兴趣,所以就尝试着开发一下 由于没有系统的学习,只能在摸索中前进,这背后的原理很简单,可不容易实 ...

  7. (一)读取PCD文件

    下面是一个简单的读取PCD文件并显示的代码: #include <iostream> #include <pcl/io/pcd_io.h> #include <pcl/p ...

  8. 丹佛机场行李系统Postmortem

    丹佛机场行李系统做Postmortem总结 事情起因是因为丹佛市场承诺进行机场建设,因此此项目问题不可回避,必须完成,合作的双方都是富有经验的公司但是最后依然变成了不可控的项目,经过小组讨论后我们认为 ...

  9. [翻译]Spring框架参考文档(V4.3.3)-第二章Spring框架介绍 2.1 2.2 翻译--2.3待继续

    英文链接:http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/overview.ht ...

  10. 10条建议提高PHP代码性能

    这篇文章中的建议涵盖了大部分PHP代码性能方面的问题.如果你是做一些小网站或者小项目,那么有理由忽略这些建议,但是当你为大量用户提供长期稳定的服务的时候,就必须关注了.开发人员必须从项目一开始就考虑这 ...