12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /*------------------------------------------------------------------------------------------------------------------------
- @package: arkiwiJsBoilerplate
- @author: cek
- @www: arkiwi.oeg
- @copyright: COPYRIGHT 18 cek
- @license: MIT
- =============================================================================
- Filename: upload.js
- =============================================================================
- This file is the main entry point for js on the arkiwiJsBoilerplate app.
- --------------------------------------------------------------------------------------------------------------------- */
- /* MODIFICARE CON GLI URL DESIDERATI */
- var ASSETSTORE = 'http://upload.arkiwi.org/arav_up_api';
- var AGGREGATOR = 'http://www.arkiwi.org';
- /*************************************/
- var arkiwi = {};
- var currentFileName = '';
- $(document).ready(function () {
- arkiwi = new ARKIWI.Arkiwi(AGGREGATOR, ASSETSTORE);
- //prepara le cose per il finto input file
- $('#displayedbrowsebutton').click(function () {
- $('input[id=hiddenfileinput]').click();
- });
- $('input[id=hiddenfileinput]').change(function() {
- $('#displayedfileinput').val($(this).val());
- //this.files[0].size gets the size of your file.
- $('#fileuploadtotal').text(this.files[0].size + ' bytes.');
- currentFileName = this.files[0].name;
- });
- $('#uploadbutton').click(function() {
- upload();
- });
- var callbacks = {
- success: function(id) {
- //$('#status').html('Session id ' + id);
- console.log('DEBUG: Session id ' + id);
- },
- unauthorized: function() {
- arkiwi.create(callbacks);
- },
- };
- arkiwi.create(callbacks);
- });
- function upload() {
- if ($('input[id=hiddenfileinput]').val() == '') {
- alert('Select a file to upload.\n (KIKI non vuoi sostituirmi con qualcosa di meglio di un alert?)');
- return false;
- }
- };
|