Tuesday 20 August 2013

Upload your file on the cloud with javascript api.

Now ShepHertz come up with upload API. You can easily upload your file on the cloud by using javascript api. File type supported are AUDIO, VIDEO , IMAGE , BINARY ,  TXT ,XML , CSV , JSON , OTHER.
Rather then storing file on your local storage upload  your file on the cloud , and you can retrieve your file .
Why to use ShepHertz api?
1). Easy to use, just do registration and get your keys and start using service.
2). Free use upto 1 million calls and store upto 1GB(1000MB) of data.
3). Mostly helpful for the individual developer .
4) samples are also provided which help the developer how to use API.
Steps to use :
1) Download the javascript sdk ,unzip and store on your local machine storage.
2). Now include App42-all-x.x.x.min.js in your project.
3).Then initialize API_KEY and SECRET_KEY in your project
                   App42.initialize("API_KEY","SECRET_KEY");
4). Now use the given code to upload your file :
   function uploadFile() {
        var upload  = new App42Upload();
        var name = "name of your file" ;
        var filePath = "path of file on your local machine"
        var fileType = "type of file you want to upload";
        var description = "description";
        upload.uploadFile(name, filePath , fileType,description,{
                success: function(object) {
                    $(".success").show();
                    var uploadObj = JSON.parse(object)
                    $('#success').html("uploadFile");
                    jAlert('File has been successfully Uploaded',"Upload File");
                    console.log(uploadObj)
                },
                error: function(error) {
                }
            });
    }
Note - When you unzip the SDK sample code is also given to help you.You can also mange or see your file from AppHQ,  AppHQ is the management console of your API.
When you register , click on dashboard, then on left pannel click on technical service , after that click the upload service where you will see your file which is uploaded. as shown in image below.

No comments:

Post a Comment