Kentico CMS 7.0 Developer's Guide

Uploading files

Uploading files

Previous topic Next topic Mail us feedback on this topic!  

Uploading files

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

There are three ways how files can be uploaded into a media library:

 

By means of the administration interface

On the live site using the Media gallery or Media file uploader web parts

Externally, directly into the file system - e.g. via FTP

 

In the following examples, you will learn how to add files into media libraries via the administration interface, on the live site and using FTP.

 

Uploading files via the administration interface

 

If you choose to Edit (Edit) a media library in CMS Desk -> Tools -> Media libraries, you can manage files in the library on the Files tab.

 

1. It is a good idea to keep your files organized in folders within the media library. To create a new folder, click the NewFolder New folder button in the top left corner of the page.

 

devguide_clip0592

 

2. Enter the name of the folder, e.g. pictures, and click OK.

 

devguide_clip0593

 

3. The folder is now created. You can upload files into the selected folder by clicking the NewFile New file button.

 

devguide_clip0594

 

4. A dialog appears, letting you upload the file. Just select the right folder and the file to be uploaded, then click the Open button.

 

5. Now if you go to the site folder in your file system, you will find the media library under the media folder, as you can see the screenshot below. The location of the folder may be customized as described here.

 

devguide_clip0595

 

On-site upload via the Media gallery and Media file uploader web parts

 

The Media gallery web part has the following two properties enabling on-site file upload:

 

Allow upload - enables on-site upload of files.

Allow upload thumbnail - enables on-site upload of file thumbnails.

 

If these properties are enabled, the controls highlighted in the screenshot below will be displayed in the web part, letting users upload files and thumbnails:

 

devguide_clip0597

 

The Media file uploader web part is also used for uploading files to your media libraries; it has the following property that enables on-site upload of file thumbnails:

 

Enable upload thumbnail - enables on-site upload of file thumbnails.

 

If the property is enabled, the users are allowed to upload both files and their thumbnails. Otherwise, only the control enabling users to browse for and upload files will be available:

 

devguide_clip1468

 

External upload

 

Files can also be uploaded externally, without any use of Kentico CMS administration interface or on-site web parts, e.g. using FTP. To do this, you simply need to copy the files into the appropriate folder of the media library.

 

1. For the purposes of this example, try uploading another file into the pictures folder by copying it using Windows Explorer or any other file manager.

 

devguide_clip1469

 

2. If you go back to the Media library administration interface, you will see the file present in the list. As you can notice, this file is marked with the warning (Warning) icon indicating that the file has not been imported yet. This means that the file has not yet been registered in the database. Such files can't be used on the site and have to be registered first. This happens only to externally uploaded files, files uploaded via the administration interface are registered in the database automatically.

 

devguide_clip0015

 

To register the file, you have to click the Import button, which creates the file's record in the database. Please note that the files are not physically copied into the database, they remain in the file system only and a record linking to the physical file is created in the database.

 

devguide_clip0302

 

Multiple files can also be imported conveniently as a batch. See Batch operations in the Files and folders management topic for more details.