-
Notifications
You must be signed in to change notification settings - Fork 158
Configuration
blackcity edited this page Jun 10, 2013
·
19 revisions
###Configuration example In this example all options are set, mostly with the default values (Note: You do not have to set the default values explicitly in your real project). All options, settings and enumerations are suggested by the Visual Studio Intellisense and verified against the schema if you follow the setup instructions in Example 02 or Example 03.
<?xml version="1.0"?> <fileUpload storageContext="Filesystem" enableIntegratedHandler="true" webFilesRoot="" uniqueFileNames="false" keepOrgFileNames="false" getInclSubFolders="true" returnFilesUrl="true" returnExtraInfo="basic" allowDelete="true" deleteHandler="~/Backload/UploadHandler" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:name="urn:fileupload-schema" xsi:noNamespaceSchemaLocation="Web.FileUpload.xsd" > <fileSystem filesRoot="~/Files" usersRoot="" objectsRoot="" /> <database assemblyName="Backload_Tester" dbContext="Backload_Tester.UpFilesEntities" entitySetName="Files" primaryKeyName="ID" /> <security allowAnonymous="true" allowedDownloadRoles="*" allowedUploadRoles="*" allowedDeleteRoles="*" /> <images width="600" height="400" dpi="96" canvasColor="#ffffffff" forceImageType="none" resizeMode="none" /> <thumbnails path="_thumbs" width="80" height="80" dpi="96" canvasColor="#00ffffff" resizeMode="ratio" imageType="image/png" /> <clientFiles scripts="~/Scripts/FileUpload/" styles="~/Content/FileUpload/css/" /> <contentTypes thumbnailPath="~/Content/FileUpload/content-types/" thumbnailSize="48" useThumbnailCanvas="true"> <!-- <clear /> // Deletes all predefined types --> <remove name="_AdobePDFFile"/> <!--Remove predefined pdf type handling--> <add name="SamplePDFFiles" extFragment=".pdf" typeFragment="application/pdf" thumbnail="PDF.png" subFolder="pdfs" /> <add name="SampleAllImageFiles" extFragment="" typeFragment="image/" thumbnail="" subFolder="images" /> </contentTypes> </fileUpload>
###Options and settings ####fileUpload (configuration section) General settings for the Backload. component. #####Attributes
- storageContext: Files may be stored in the file system or in a database (by the Entity Framework) [Default: "Filesystem"].
- enableIntegratedHandler: By default the internal file upload handler is running and ready to receive incoming files (PUT/POST) or requests (GET or DELETE). If you want to set up your own controller in order to do some business logic, set this to "false". [Default: "true"].
- webFilesRoot: Leave this an empty string, if filesRoot is relative to the web root (starts with '~/', see filesRoot). If filesRoot is an absolute local path (see filesRoot) this must be an absolute web url to the files root (e. g. "http://myfiles.filestore.com/files/" [Default: ""].
- uniqueFileNames: Generates unique file names based on guids [Default: "false"].
- keepOrgFileNames: Only applies if you use the uniqueFileNames option. If set to true, the original file name will be tracked (subfolder: _mappings) [Default: "false"].
- getInclSubFolders: On a GET request (return links to uploaded files) only the upload root folder (Default: filesRoot/[objectsRoot]) is searched for uploaded files. If "true", the search includes subfolders. (Example: A content-type specific subfolder is set to "pdffiles" the search will find files within this subfolder. There are several other ways setting up subfolders, e.g. uploadContext and objectContext) [Default: "false"].
- returnFilesUrl: By default the url to the uploaded files is returned, so the user is able to open the uploaded file (download). If you do not want that default behaviour set this to "false", so users are not able to download files. In this case, in order to provide download capabilities, you can setup your own contollers/handlers with your own business logic [Default: "true"].
- returnExtraInfo: Returns information about original file names, folders (returnFilesUrl must be "true") and extra message [Default: "basic"].
- allowDelete: Set to "false" if deletion of uploaded files should be not possible [Default: "true"].
- deleteHandler: By default (deleteHandler="") the Backload component handles incoming delete requests. If you need to delete uploaded files within your own business logic set a relative (~/...) or absolute path (starts with http or https). The url of the handler is returned to the browser in the json output for the delete url [Default: ""].
- xmlns:xsi: No custom setting. Used for schema validation and Visual Studio Intellisence. Registers the xsi namespace [Default: "http://www.w3.org/2001/XMLSchema-instance"].
- xmlns:name: No custom setting. Used for schema validation and Visual Studio Intellisence. Registers the namespace for the schema [Default: "urn:fileupload-schema"].
- xsi:noNamespaceSchemaLocation: No custom setting. Used for schema validation and Visual Studio Intellisence. Path to the schema file [Default: "Web.FileUpload.xsd"].
#####Configuration elements
- fileSystem: Sets up the root folders if storageContext="Filesystem". If you don't need a greater control on the storage structure all files will be stored directly in the root folders (flat structure). Otherwise you may use the content type based subfolder settings (config file) or the objectContext/uploadContext parameters sent with each client side request, which altogether support a very complex storage structures.
- database:
- security:
- images:
- thumbnails:
- clientFiles:
- contentTypes: