simpapp-phonegap-file-upload
v1.0.21
Published
jQuery based file upload
Downloads
9
Maintainers
Readme
jQuery File Upload
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.
};