Sitecore Upload Image to Media Library Programmatically

Upload a file to the Media Library

Abstract

In the Media Library, at that place are three different methods to upload your media files.

In the Media Library, in that location are three different methods to upload your media files:

  • Upload file – use this choice to upload a unmarried file.

  • Upload files (avant-garde) – use this option to upload multiple files or to apply upload options. For case, you can upload a Aught archive or overwrite duplicates.

  • Elevate & Drop – use this option to upload a single file or multiple files by dragging them from Windows Explorer to the Sitecore Media Library.

    Annotation

    The drag-and-drop functionality is currently only supported in Internet Explorer vii or subsequently. If you employ a dissimilar browser such as Mozilla Firefox, y'all must utilize the Upload file and Upload files (advanced) options to upload your files to the Media Library.

Media files that you upload to the Media Library are not versionable by default. If a media file is versionable, a new version of the media item is created automatically every fourth dimension you edit it. This enables yous to revert back to an older version of an item after you lot edit the detail. To brand a media file versionable, yous can either utilise the Upload files (avant-garde) option or set up the Drag & Driblet option to brand all media files versionable by default when they are uploaded past Drag & Drop .

To upload a media file:

  1. In the Media Library, in the content tree, select the folder that you want to upload your media file to.

  2. In the editing pane, on the Binder tab, click Upload file.

    The content editor with a folder in the Media Library selected

  3. In the Upload file dialog box, click Browse.

  4. In the File Upload dialog box, browse and select the media file that you desire to upload and click Open.

  5. In the Upload file dialog box, click Upload.

To upload multiple files or apply upload options:

  1. In the Media Library, in the content tree, select the folder that you desire to upload your media files to.

  2. In the editing pane, on the Folder tab, click Upload files (advanced).

    The content editor with a folder in the Media Library selected

  3. In the Batch Upload dialog box, in the Select file(s) to upload hither field, click Browse.

    The Batch Upload dialog box with one browse button

  4. In the File Upload dialog box, browse to an image you want to upload.

    Note

    If y'all are working in Cyberspace Explorer, you lot can upload multiple files at once. To select multiple files, press and hold the CTRL key when you select the files.

  5. Click Open.

    The proper noun of the selected file appears side by side to the Browse push, and a new Scan button appears below.

    The Batch Upload dialog box with two Browse buttons

  6. To upload boosted files, click the Scan push that has no file selected, select a file and click Open.

  7. When you accept added all the files yous want to upload, in the Batch Upload dialog box, select the relevant options.

    Upload option

    Description

    Unpack ZIP archives

    Select this option to upload and excerpt a Zip archive to the Media Library.

    In the .naught file, you can include subfolders with files. The folder structure is re-created in the Media Library after the files are extracted.

    Brand uploaded media items versionable

    Select this choice to make the media file versionable. This creates the media file in the selected language only, and any other language version that yous want you need to create manually.

    Overwrite existing media items

    Select this pick to upload a file with the same name as a file that already exists in the Media Library, and want to overwrite the existing file.

    If you exercise not select this option, a duplicate file is created in the Media Library.

  8. Click Upload. and the uploaded images are added to the selected folder in the Media Library.

  9. When all of the images appear in the Uploaded media items department, click Close.

Note

A warning appears on an item If the Alt field is empty. To remove the warning, open the media item in the content editor and enter an alternating text in theAlt field.

If you lot work in Internet Explorer 7 or afterwards, the drag-and-drop option is the quickest and easiest way to upload media files to the Media Library. You tin upload single or multiple files from your estimator to the Elevate & Drop dialog box. This is peculiarly useful when yous want to upload many files to different locations in Sitecore or from different locations on your reckoner.

To drag and driblet files to the Media Library:

  1. In the Media Library, select the binder that you desire to upload the files to.

  2. To open the Drag & Drop dialog box, from the editing pane, on the Folder tab, click Drag & Drib.

  3. Open Windows Explorer and navigate to the folder where the images are stored and select the images you lot want to upload.

  4. Position Windows Explorer next to the Elevate & Driblet dialog box and drag the selected images from Windows Explorer to the Drag & Drop dialog box.

    Note

    If you demand to upload files to or from other locations, simply navigate through the folder construction either in the Elevate & Drop dialog box or in Windows Explorer. You do not accept to close the dialogs and outset over.

  5. When you have dragged and dropped all your media files, click Done to copy them to the Media Library.

    Note

    If the folder you lot copy to already contains a media items with the same name, the Copy File dialog box opens, asking you to decide how to handle the duplicate media items.

    In the editing pane, on the Binder tab, in the Media section, you tin come across the images that you uploaded. Each new particular contains a warning.

  6. To remove the warnings, open up each media item and enter the alternate text in the Alt field.

Make uploaded media files versionable past default

To make all the media files that you upload to the Drib & Drag dialog box versionable past default:

  1. Open the Sitecore.config file that is stored in the web root binder of your website: C:\Inetpub\wwwroot\<YourSitecoreWebsite>\Website\App_Config

  2. Right-click the Sitecore.config file, click Open With, and then click Notepad.

  3. Locate the following setting and change the value to Truthful:

    <setting name="Media.UploadAsVersionableByDefault" value="false" />

  4. Salvage your changes.

  5. Open the Media Library.

  6. Click the Sitecore system carte du jour The Sitecore system menu icon and so click Application Options.

  7. In the Application Options dialog box, click the Media tab, and select the Show only latest version of files option.

unaiponarabor.blogspot.com

Source: https://doc.sitecore.com/xp/en/users/91/sitecore-experience-platform/upload-a-file-to-the-media-library.html

0 Response to "Sitecore Upload Image to Media Library Programmatically"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel