simpapp-phonegap-file-upload

1.0.21 • Public • Published

jQuery File Upload

By Theramore at simpapp.ro

For questions and more visit the at Dev Forum!

Mainly created for Android & iOS file upload

This is not click bait! This library works on Phonegap/Cordova, no permissions required and easy to use.

### Prerequisites

jQuery is required. If not included will automatically load jQuery.min from Google Hosted Libraries

Installing

Just include the simpapp.js file as following and use after pageload event :

<!DOCTYPE HTML>
<html>
    <head>
        <title>File Upload Example</title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    </head>
    <body>
        <div>
        <span id="upload-progress">0</span>
            <input type="file" name="img" id="image" multiple />
            <button class="" onclick="submit();">Upload</button>
        </div>
    </body>
    <script type="text/javascript">
        function submit()
        {
            var opts = {
                multiple: true
            };
            console.log('file submited');
            simp.init("http://forum.simpapp.ro/testup.php", opts);
            
            simp.doUpload(function (data)
            {
                console.log(data);
                alert('uploaded');
            },function (err)
            {
                console.log(err);
                alert('failed');
            },function onProgress(percent)
            {
                $('#upload-progress').html(percent + '%');
            });
        }
    </script>
    <script type="text/javascript" src="simpapp.js"></script>
</html>
opts = {
    multiple: false, //Inputs have "multiple" tag
    progress: true, //if you want the upload to return percentage
    inputName: [], // for multiple file inputs, leave blank for default.
};

Package Sidebar

Install

npm i simpapp-phonegap-file-upload

Weekly Downloads

9

Version

1.0.21

License

ISC

Last publish

Collaborators

  • theramore95