SlickUpload Documentation
- Installation
- Configuration
- Quick Start Guide
- How To
- Concepts
- Troubleshooting
- FAQ/Known Issues
- Upgrading
- Client Reference
-
Server Reference
- Class reference syntax
- Installing the license
-
SlickUpload Namespaces
- Krystalware.SlickUpload
- Krystalware.SlickUpload.Configuration
- Krystalware.SlickUpload.Storage
- Krystalware.SlickUpload.Storage.Streams
- Krystalware.SlickUpload.Web
- Krystalware.SlickUpload.Web.Controls
- Krystalware.SlickUpload.Web.Controls.Design
- Krystalware.SlickUpload.Web.Handlers
- Krystalware.SlickUpload.Web.Mvc
- Krystalware.SlickUpload.Web.SessionStorage
Configuration
SlickUpload's configuration is controlled by Web.config settings in the <slickUpload> element.
<slickUpload handleRequests="boolean"
scriptUrl="url to slickupload.js">
<uploadProfiles defaultProfile="provider name">
<add name="provider name"
documentDomain="host name"
maxRequestLength="number of kilobytes"
executionTimeout="number of seconds">
<uploadStreamProvider type="provider type" />
<uploadFilter type="filter type" />
</add>
</uploadProfiles>
<sessionStorageProvider type="provider type"
updateInterval="number of seconds"
staleTimeout="number of seconds" />
</slickUpload>
Configuration Elements
<slickUpload>
This is the root element of the SlickUpload configuration.
Attributes
- handleRequests – Optional Boolean attribute
-
Boolean that specifies whether to handle requests. Default:
true - scriptUrl – Optional String attribute
-
String that specifies the URL to use to load the SlickUpload JavaScript. If no url is specified, SlickUpload will automatically use WebResource.axd to include the version compiled into the SlickUpload assembly. Default:
null
Child Elements
<uploadProfiles>– contains a list of the configured uploadProfiles that direct SlickUpload how and where to upload files. Required.<sessionStorageProvider>– configures the provider SlickUpload uses to store upload session information while an upload is in progress. Optional.
<uploadProfiles>
This element contains a list of the configured uploadProfiles that direct SlickUpload how and where to upload files. This element is required.
<uploadProfiles defaultProfile="provider name">
<add name="provider name"
documentDomain="host name"
maxRequestLength="number of kilobytes"
executionTimeout="number of seconds">
<uploadStreamProvider type="provider type" />
<uploadFilter type="filter type" />
</add>
</uploadProfiles>
Attributes
- defaultProfile – Optional String attribute
-
Specifies the default profile name to use if none is specified in the upload configuration. Default:
null
Child Elements
<add>– adds an upload profile configuration to the list of available upload profiles.
<add> (uploadProfiles)
This element adds an upload profile configuration to the list of available upload profiles.
<add name="provider name"
documentDomain="host name"
maxRequestLength="number of kilobytes"
executionTimeout="number of seconds">
<uploadStreamProvider type="provider type" />
<uploadFilter type="filter type" />
</add>
Attributes
- name – Optional String attribute
-
Specifies the profile name for this upload profile. Default:
null - documentDomain – Optional String attribute
-
Specifies the document.domain value to set in ajax handlers. Default:
null - maxRequestLength – Optional Integer attribute
-
Specifies the maximum request length for this upload profile, in kilobytes. Default:
2097152 - executionTimeout – Optional Integer attribute
-
Specifies the execution timeout for this upload profile, in seconds. Default:
86400
Child Elements
<uploadStreamProvider>– configures the provider SlickUpload uses to get streams to use to store uploaded files as they are uploaded.<uploadFilter>– configures an upload filter class that allows you to specify code that will determine whether SlickUpload should handle or reject a request.
<uploadStreamProvider>
This element configures the provider SlickUpload uses to get streams to use to store uploaded files as they are uploaded. This element is required.
<uploadStreamProvider type="provider type" />
Attributes
- type – Optional String attribute
- Specifies the type of upload stream provider to use. See the list of available UploadStreamProvider types below.
UploadStreamProvider types
The following types are available:
File – stores uploaded files in the filesystem, either locally or using a network location.
<uploadStreamProvider type="File" location="~/files" />
If you want more control over the storage location, you can inherit from the FileUploadStreamProvider class to create your own custom file based upload stream provider. For more information, see the how to upload to disk topic.
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.
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.
Client
SqlClient – stores uploaded files in a SQL Server database using an IMAGE column.
<uploadStreamProvider type="SqlClient" connectionStringName="SlickUpload" table="SlickUploadFile" keyField="FileId" dataField="Data" fileNameField="FileName" dataType="Image" />
If you want more control over the storage location, you can inherit from the SqlClientUploadStreamProvider class to create your own custom SQL Server based upload stream provider. For more information, see the how to upload to SQL Server topic.
Attributes
- connectionString – Optional String attribute
-
Specifies the connection string to use. Default:
null. Either connectionString or connectionStringName must be specified. - connectionStringName – Optional String attribute
-
Specifies the name of the connection string in the
<connectionSrings>section to use. Default:null. Either connectionString or connectionStringName must be specified. - table – Required String attribute
- Specifies the name of the table to upload to.
- keyField – Required String attribute
- Specifies the name of the key field in the upload table.
- dataField – Required String attribute
- Specifies the name of the data field in the upload table.
- fileNameField – Optional String attribute
-
Specifies the name of the file name field, or null if no filenames are to be stored. Default:
null - useInsertTransaction – Optional String attribute
-
Specifies whether to use a transaction that wraps inserting into the table and streaming data into the file data field. Default:
false - dataType – Optional SqlColumnDataType attribute
-
Specifies the data type for the file data field. Possible values:
- Image
- The SQL Server IMAGE data type.
- VarBinaryMax
- The SQL Server VARBINARY(MAX) data type.
- FileStream
- The SQL Server FILESTREAM data type.
Image
S3 – streams uploaded files to Amazon S3.
<uploadStreamProvider type="S3" accessKeyId="" secretAccessKey="" bucketName="" />
Attributes
- accessKeyId – Required String attribute
- Specifies the Amazon S3 AccessKeyId to use.
- secretAccessKeyId – Required String attribute
- Specifies the Amazon S3 SecretAccessKey to use.
- bucketName – Required String attribute
- Specifies the Amazon S3 bucket in which to store files. The bucket must already exist – SlickUpload will not create it.
- useHttps – Optional Boolean attribute
- Specifies whether to use HTTPS for connections to S3. Defaults to true.
- objectNameMethod – Optional ObjectNameMethod attribute
-
Specifies the method to use to generate an object name. Possible values:
- Client
- Use the client filename as the object name.
- Guid
- Use a unique GUID as the object name.
- GuidWithExtension
- Use a unique GUID with the client filename's extension appended as the object name.
Client - cacheControl – Required String attribute
- Specifies the Expires header to apply to the object.
- contentDisposition – Required String attribute
- Specifies the Content-Disposition header to apply to the object. One use of this header is to cause a browser to download this resource as a file attachment instead of displaying it inline. For that behavior, use a string like: "Content-disposition: attachment; filename={0}". SlickUpload will replace {0} with the file's client name.
- contentEncoding – Required String attribute
- Specifies the Content-Encoding header to apply to the object.
- cannedAcl – Optional S3CannedAcl attribute
-
Specifies the Amazon S3 Access Control List (ACL) setting to use for an object.
- Private
- Owner gets FULL_CONTROL. No one else has access rights (default).
- PublicRead
- Owner gets FULL_CONTROL. Anonymous users (the AllUsers) group gets READ access. If this policy is used on an object, it can be read from a browser with no authentication.
- PublicReadWrite
- Owner gets FULL_CONTROL, Anonymous users (the AllUsers) group gets READ and WRITE access.
- AuthenticatedRead
- Owner gets FULL_CONTROL. The AuthenticatedUsers group (any principal authenticated as a registered Amazon S3 user) gets READ access.
- BucketOwnerRead
- Object owner gets FULL_CONTROL. Bucket owner gets READ access. If specified when creating a bucket, Amazon S3 ignores it.
- BucketOwnerFullControl
- Both the object owner and the bucket owner get FULL_CONTROL. If specified when creating a bucket, Amazon S3 ignores it.
Private - storageClass – Optional S3ScorageClass attribute
-
Specifies the method to use to generate an object name. Possible values:
- Standard
- Use standard storage.
- ReducedRedunancy
- Use reduced redundancy storage.
Standard
Memory – stores uploaded files in a MemoryStream.
<uploadStreamProvider type="Memory" />
Custom – use a custom provider to store uploaded files.
To specify a custom provider, set the
<uploadStreamProvider>typeattribute to a reference to your custom provider class. The class reference syntax topic has more information on the reference syntax.<uploadStreamProvider type="YourNamespace.YourClassName, YourAssembly" />
You can add additional attributes to the section. They will be accessible in your custom provider class.
<uploadFilter>
This element configures an upload filter class that allows you to specify code that will determine whether SlickUpload should handle or reject a request. This element is optional.
<uploadFilter type="provider type" />
Attributes
- type – Optional String attribute
-
Specifies the type of your upload filter. This should be a reference to your custom provider class. The class reference syntax topic has more information on the reference syntax.
<uploadFilter type="YourNamespace.YourClassName, YourAssembly" />
<sessionStorageProvider>
This element configures the provider SlickUpload uses to store upload session information while an upload is in progress. This element is optional.
<sessionStorageProvider type="provider type"
updateInterval="number of seconds"
staleTimeout="number of seconds" />
Attributes
- type – Optional String attribute
- Specifies the type of session storage profile to use. See the list of available SessionStorageProvider types below. Defaults to Adaptive.
- updateInterval – Optional Integer attribute
-
Specifies the the session update interval, in seconds. Default:
1 - staleTimeout – Optional Integer attribute
-
Specifies the session timeout, in seconds. Default:
1800
SessionStorageProvider types
The following types are available:
Adaptive – adapts to the current ASP.NET session state setting. If session state mode="Off" or mode="InProc", it will use the InProc session storage provider to store the information in process. For all other settings, it will use the SessionState session storage provider to store the information in ASP.NET session state. This is the default.
<sessionStorageProvider type="Adaptive" />
InProc – stores session information in process.
<sessionStorageProvider type="InProc" />
SessionState – stores session information in ASP.NET session state.
<sessionStorageProvider type="SessionState" />
SqlClient – stores session information in a SQL Server database.
<sessionStorageProvider type="SqlClient" connectionStringName="SlickUpload" table="SlickUploadStatus" sessionIdField="SessionId" requestIdField="RequestId" statusField="Status" lastUpdatedField="LastUpdated" />
Attributes
- connectionString – Optional String attribute
-
Specifies the connection string to use. Default:
null. Either connectionString or connectionStringName must be specified. - connectionStringName – Optional String attribute
-
Specifies the name of the connection string in the
<connectionSrings>section to use. Default:null. Either connectionString or connectionStringName must be specified. - table – Required String attribute
- Specifies the name of the table in which to store session information.
- sessionIdField – Required String attribute
- Specifies the name of the SessionId key field in the session table.
- requestIdField – Required String attribute
- Specifies the name of the RequestId key field in the session table.
- statusField – Required String attribute
- Specifies the name of the field in which to store status information.
- lastUpdatedField – Required String attribute
- Specifies the name of the field that holds the last updated timestamp.
Custom – use a custom provider to store session information.
To specify a custom provider, set the
<sessionStorageProvider>typeattribute to a reference to your custom provider class. The class reference syntax topic has more information on the reference syntax.<sessionStorageProvider type="YourNamespace.YourClassName, YourAssembly" />
You can add additional attributes to the section. They will be accessible in your custom provider class.