Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p>The following example allows your user to upload a file directly from your page to your Cincopa account.<br>
Upload is done in chunks which makes sure to retransmit in case of a chunk failure.<br>
When upload is complete the video/audio will be available for watching immediately using Cincopa player, see onUploadComplete().<br>
Replace A4HAcLOLOO68 (default video player) and AEFALSr3trK4 (default audio player) with your player/gallery code to customize the player.<br>
Paste this code to your page, don't forget to replace the static upload URL (line 4) with your upload URL. You can get this URL from https://www.cincopa.com/cincopamanager/api or use Cincopa REST API https://www.cincopa.com/media-platform/api-documentation-v2 method asset.get_upload_url.json</p>

<script type="text/javascript" src="https://rtcdn.cincopa.com/libasync.js"></script>
<script type="text/javascript" src="https://wwwcdn.cincopa.com/_cms/ugc/uploader.js"></script>
<input type="file" class="fileuploader" id="upload-input">
<div class="status-bar"></div><button type="button" class="start">Start</button><button type="button" class="stop">Stop</button><button type="button" class="pause">Pause</button><button type="button" class="resume">Resume</button>
<br><br>
<div id="dropArea" style="width:500px;height:200px;border:1px solid red;">Example of a drop area</div>
<br><br>
<div id="thediv"></div>



              
            
!

CSS

              
                
              
            
!

JS

              
                var uploader;

var options = {
    url: "https://media.cincopa.com/post.jpg?uid=1411253&d=AAAAcAQtIWBAAAAAAEJqhoA&hash=x521bdtt1lmc3rau4i4qxx4rj3oqhp4b&addtofid=0",
    chunk_size: 10, // MB
    onUploadComplete: function (e) {
      console.log("onUploadComplete");
      console.log(e);
      $(".status-bar").html("File has been successfully uploaded rid=" + e.rid);
      if (e.type.startsWith("video"))
        cincopa.boot_gallery({"_object": "thediv", "_fid": "A4HAcLOLOO68!"+e.rid})
      else if (e.type.startsWith("audio"))
        cincopa.boot_gallery({"_object": "thediv", "_fid": "AEFALSr3trK4!"+e.rid})
    },
    onUploadProgress: function (e) {
      console.log(e);
      $(".status-bar").html(parseInt(e.percentComplete) + '%');
    },
    onUploadError: function (e) {
      console.log(e);
      $(".status-bar").html("Error accured while uploading");
    }
};


$('.fileuploader').change(function (e) {
  var file = e.target.files[0];
  uploader = new cpUploadAPI(file, options);
});

var dropArea = $('#dropArea')[0];
dropArea.ondragover = function (e) {
  e.stopPropagation();
  e.preventDefault();
  return false;
}; 
dropArea.ondragleave = function (e) {
  e.stopPropagation();
  e.preventDefault();
  return false;
};
dropArea.ondrop = function (e) {
  e.preventDefault();
  var file = e.dataTransfer.files[0];
  uploader = new cpUploadAPI(file, options);
  
  $('#dropArea').html("dropped " + file.name + " click start");
};

$(".start").click(function () {
    uploader.start();
});
$(".stop").click(function () {
    uploader.stop();
});
$(".pause").click(function () {
    uploader.pause();
})

$(".resume").click(function () {
    uploader.resume();
})



              
            
!
999px

Console