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
Upgrading
Follow the steps below to upgrade an existing SlickUpload 5 application to SlickUpload 6. SlickUpload has changed a bit since the last version to support features like drag/drop, multiselect and upload profiles, so this upgrade is more intensive than previous upgrades. If you have a question or run into a snag during the upgrade process, post on the SlickUpload support forums or shoot us an email at support@slickupload.com and we'll help you out.
NOTES:
- This guide covers upgrading from SlickUpload 5 to SlickUpload 6. If you have version 3 or version 4, get the SlickUpload 5 documentation package and follow the Upgrading instructions there first. If you have version 1 or 2, we recommend removing your current SlickUpload code and reimplementing using the SlickUpload Quick Start guide – SlickUpload has changed greatly in the past several versions.
- If you have an existing license and want to upgrade it to a SlickUpload 6 license, we offer a 50% license upgrade discount. Email your current license file to orders@slickupload.com. We will respond with a discount code for your upgrade.
TIP: When you're going to copy paste the code from a code snippet below, here's the easy way: double click anywhere within the snippet box. This will select all of the code for any code snippet so you can easily copy it to the clipboard.
Upgrade Process
This upgrade guide is broken out with functional topics that describe how to upgrade each piece of your code to work with SlickUpload 6. You'll need to go through the first few topics that cover upgrading the web.config, etc., but some of the more advanced topics may not be relevant depending on which features you're using.
Upgrade steps
- Install the SlickUpload 6 assembly
- Upgrade web.config
- Upgrade upload stream provider config
- Upgrade file name generator config
- Upgrade criteria generator config
- Upgrade status manager config
- Upgrade server side code
- Upgrade custom upload stream provider code
- Upgrade SqlClientOutputStream/SqlClientInputStream references
- Upgrade page markup
- Upgrade Post Processing
- Upgrade client code
Install the SlickUpload 6 assembly
- Download the latest SlickUpload package from the SlickUpload download page.
- Select the correct Krystalware.SlickUpload.dll for your .NET framework version. The file in the /Bin-NET2 directory is for .NET 2.0, and the file in the /Bin-NET35 directory is .NET 3.5 and later. SlickUpload 6 no longer supports .NET 1.1 – if you're still on .NET 1.1, you may want to upgrade to the latest version of SlickUpload 5.
- Remove the old Krystalware.SlickUpload.dll from your project and add a reference to the new Krystalware.SlickUpload.dll.
Upgrade web.config
-
Replace the entire SlickUpload <sectionGroup> registration in <configSections> with the following:
<section name="slickUpload" type="Krystalware.SlickUpload.Configuration.SlickUploadSection, Krystalware.SlickUpload" requirePermission="false" />
-
Create a new <slickUpload> section at the root of the web.config (after <configSections>) with the following template (don't remove your old tag just yet, as you'll be copying things from it to the new tag):
<slickUpload> <uploadProfiles defaultProfile="default"> <add name="default"> <uploadStreamProvider /> </add> </uploadProfiles> </slickUpload> - Remove the <httpRuntime> tag from the <system.web> section (if you are using it to control SlickUpload). To set maxRequestLength and executionTimeout in SlickUpload 6, add those attributes to the <add> tag for your upload profile.
- Remove the SlickUpload.axd handler from <system.web>/<httpHandlers> and <system.webServer>/<handlers> if they exist.
- Update the SlickUpload <system.web>/<httpModule> registration as follows:
<add name="SlickUploadModule" type="Krystalware.SlickUpload.Web.SlickUploadModule, Krystalware.SlickUpload" />
- Update the SlickUpload <system.webServer>/<modules> registration as follows (if it exists):
<add name="SlickUploadModule" type="Krystalware.SlickUpload.Web.SlickUploadModule, Krystalware.SlickUpload" preCondition="integratedMode" />
- Run through the following topics to upgrade other parts of web.config.
- Once you're done upgrading web.config, remove the old <slickUpload> configuration section from the web.config
Upgrade upload stream provider config
If you have multiple handlers with different URL's, so that you can configure SlickUpload to store files differently for different pages, that concept has been made obsolete with SlickUpload 6. Instead, you can create multiple uploadProfiles and specify which to use in the SlickUpload control definition.
If you do have this case:
- Copy the upload profile tag created above for each handler that you have:
<add name="default"> <uploadStreamProvider /> </add> - Create a unique name for each upload profile
- Perform the following steps for each <location> tag you have configured to move the <uploadStreamProvider /> configuration into the upload profile.
- On your page, remove the UploadUrl attribute and add the UploadProfile attribute with the name that corresponds to the new upload profile.
If you don't have multiple handlers, perform the following steps once:
- Replace the <uploadStreamProvider /> tag above with the <uploadStreamProvider /> tag from your old slickUpload configuration in web.config
- If your provider type is not custom, rename the "provider=" attribute in the <uploadStreamProvider> tag you just replaced to be named "type="
- If your provider type is custom, remove the "provider=" attribute in the <uploadStreamProvider> tag
- If your provider type is SqlFileStream, change the type attribute to be type="SqlClient" and add the dataType="FileStream" attribute
Upgrade file name generator config
In SlickUpload 6, the IFileNameGenerator interface has been merged into the FileUploadStreamProvider. To move your logic to the correct spot:
- Create a new class that inherits from FileUploadStreamProvider
- Override the GetServerFileName method
- Copy your IFileNameGenerator code to the new GetServerFileName method
- Change the type= attribute in your
tag to point to your new class (update with the reference to your new class. If your class is in App_Code, remove YourAssemblyName and the trailing comma): <uploadStreamProvider type="YourNamespace.YourClassName, YourAssembly" />
- Remove the fileNameMethod and fileNameGenerator attributes
Upgrade criteria generator config
In SlickUpload 6, the ICriteriaGenerator interface has been merged into the SqlClientUploadStreamProvider. To move your logic to the correct spot:
- Create a new class that inherits from SqlClientUploadStreamProvider
- Override the InsertRecord method
- Copy your ICriteriaGenerator code to the new InsertRecord method
- Update your code to use the passed in connection (and transaction if applicable). Using the transaction is required for SqlFileStream providers.
- Change the type= attribute in your
tag to point to your new class (update with the reference to your new class. If your class is in App_Code, remove YourAssemblyName and the trailing comma): <uploadStreamProvider type="YourNamespace.YourClassName, YourAssembly" />
- Remove the criteriaMethod and criteriaGenerator attributes
Upgrade status manager config
- If you have a <statusManager> tag defined, rename it to <sessionStorageProvider> and move it from your old <slickUpload> config section to the new <slickUpload> config section.
- If your status manager type is not custom, rename the manager= attribute in the <sessionStorageProvider> tag you just renamed to be named type=
- If your status manager type is "ApplicationState", change it to "InProc"
- If your status manager type is "SqlServer"
- Delete your old SlickUpload status table and run SlickUploadStatusTable.sql to create a new table
- Remove the table, keyField, statusField, and lastUpdateField attributes and replace them with the following:
- table="SlickUploadStatus" sessionIdField="SessionId" requestIdField="RequestId" statusField="Status" lastUpdatedField="LastUpdated"
- If your status manager type is custom, remove the provider= attribute in the <uploadStreamProvider> tag
Upgrade server side code
Things have moved around in SlickUpload 6. To update your code to match the new locations, perform the following search and replace operations:
| Old | New |
|---|---|
| Krystalware.SlickUpload.Controls | Krystalware.SlickUpload.Web.Controls |
| Krystalware.SlickUpload.Providers | Krystalware.SlickUpload.Storage |
| Krystalware.SlickUpload.Streams | Krystalware.SlickUpload.Storage.Streams |
| Krystalware.SlickUpload.Status | Krystalware.SlickUpload.Web.SessionStorage |
| UploadedFile.LocationInfo[FileUploadStreamProvider.FileNameKey] | UploadedFile.ServerLocation |
| UploadedFile.LocationInfo[SqlClientUploadStreamProvider.IdentityIdKey] | UploadedFile.ServerLocation |
| UploadedFile.LocationInfo | UploadedFile.Data |
| UploadedFile.FormValues | UploadedFile.Data |
| UploadStatus | UploadSession |
| UploadStatusEventArgs | UploadSessionEventArgs |
| UploadSession.Reason | UploadSession.ErrorType |
Other code details
- UploadState.PostProcessingComplete has been removed. If a file is post processing, the status will still be UploadState.Uploading. When the file has completed, the status will be UploadState.Complete.
- The SlickUpload configuration is now accessible through the SlickUploadContext.Config accessor.
- If you want to access the current upload profile (and UploadStreamProvider etc.) configuration, you can get that through the SlickUploadContext.CurrentUploadSession.UploadProfile accessor
Upgrade custom upload stream provider code
- The method names for IUploadStreamProvider have changed. Rename as follows:
Old New GetInputStream GetReadStream GetOutputStream GetWriteStream - If your UploadStreamProvider uses UploadedFile.LocationInfo, rename that to use UploadedFile.Data
- If your UploadStreamProvider only returns one piece of data, you can store that in UploadedFile.ServerLocation
- Add a constructor that accepts a parameter of type UploadStreamProviderElement. Your class will be passed the configuration section used to configure the UploadStreamProvider. You can access the configuration attributes through the Parameters collection.
Upgrade SqlClientOutputStream/SqlClientInputStream references
- Rename as follows:
Old New SqlClientOutputStream SqlClientReadStream SqlClientInputStream SqlClientWriteStream - Add a trailing parameter to the constructor call of Krystalware.SlickUpload.Storage.SqlColumnDataType.Image
Upgrade page markup
- Perform the following renames:
Old New UplevelSelectorTemplate SelectorTemplate DownlevelSelectorTemplate SelectorUnskinnedTemplate FileTemplate FileItemTemplate - For controls inside the templates, perform the following renames:
Old New FileListRemoveLink FileListRemoveCommand FileListFileName FileListElement Element="FileName" FileListValidationMessage FileListElement Element="ValidationMessage" UploadProgressElement Element="FileCountText" UploadProgressElement Element="FileCount" UploadProgressBarElement UploadProgressBar - The ShowDuringUploadElements and HideDuringUploadElements properties have been removed. If you have controls you want to hide or show during uploads, connect javascript to the OnClientUploadSessionStarted and OnClientBeforeSessionEnd events to control visibility. For example:
<kw:SlickUpload ... OnClientUploadSessionStarted="onSessionStarted" OnClientBeforeSessionEnd="onBeforeSessionEnd" ...
function onSessionStarted(data) { // TODO: show/hide elements during upload } function onBeforeSessionEnd(data) { // TODO: show/hide elements after upload }
Upgrade Post Processing
The interaction method for Post Processing has been changed slightly. To update your post processing code:
- Set the post processing data to the UploadSession.ProcessingStatus dictionary
- Remove calls to UpdatePostProcessStatus
- Remove the Krystalware.SlickProgress control registration directive on your page
- Perform the following renames:
Old New ProgressBarElement UploadProgressBar ProgressElement UploadProgressElement - Remove the HasPostProcessStep="true" attribute from the SlickUpload control
- Rename the OnClientProgressUpdate attribute on the SlickUpload control to OnClientUploadSessionProgress
- Change the client script in the OnClientUploadSessionProgress handler to use the new client API by changing this line:
if (postProcessProgress.style.display == "none" && data.state == "PostProcessing")
To this:if (data.state == "Completing" && data.percentComplete != 100)
Upgrade client code
- kw.get("id") has become kw("id") (jQuery style)
- slickUpload.submit() has become slickUpload.start()