Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Media Archive Toolbar Options For .json File

$
0
0
You can map the .json extension to one of the supported MIME types like "text/js" or "text/plain":
  1. Edit web.config
  2. Add the mapping below configuration/system.webServer/staticContent
  3. Save web.config
<configuration>
  <!-- ... -->
  <system.webServer>
    <!-- ... -->
    <staticContent>
      <!-- ... -->
      <mimeMap fileExtension=".json" mimeType="text/plain" />
    </staticContent>
    <!-- ... -->  
  </system.webServer>
  <!-- ... -->
 </configuration>
One more thing.

If you have uploaded .json files to the media archive before you do the change described above, these files have the MIME type of "application/octet-stream" (by default):
<MediaFileDataElements Id="01c27ae7-5894-45ae-ad88-06c44bb0aa09" FolderPath="/" FileName="sample.json" Title="" Description="" CultureInfo="en-US" MimeType="application/octet-stream" Length="603" CreationTime="2016-03-04T10:08:02.8341896+02:00" LastWriteTime="2016-03-04T10:08:02.8341896+02:00" />
So these files will still be non-editable.

For these files, you can. for example:
  • either replace the MimeType of these files to "text/plain" (or whichever you've chosen) manually in ~/App_Data/Composite/DataStores/Composite.Data.Types.IMediaFileData.xml (or an equivalent SQL table)
  • or upload them again overwriting the existing ones ("Media" > "Download", then "Upload File" with the "Replace existing file" option enabled)
All the .json files uploaded after you've made the change in web.config should get the correct MIME type and no change will normally be needed for them.

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>