In my MebileWeb, WebView I browse to the image using
<input type="file" id="files" name="files[]" multiple /> <output id="list"></output>then I extract and confirm the file with
<script> function handleFileSelect(evt) { var files = evt.target.files; // FileList object for (var i = 0, f; f = files[i]; i++) { if (!f.type.match('image.*')) { continue; } var reader = new FileReader(); // Closure to capture the file information. reader.onload = ( function(theFile) { return function(e) { // test thumbnail var span = document.createElement('span'); span.innerHTML = ['<img class="thumb" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join(''); document.getElementById('list').insertBefore(span, null); }; })(f); reader.readAsDataURL(f); } } document.getElementById('files').addEventListener('change', handleFileSelect, false); </script>and finally, update the logged-in user, (which does not yet have a photo), with reader.onload's
e.target.result// { result : e.target.result } is passed from WebView's HTML reader.onload to this external .js Cloud.Users.update({ photo: e.result }, function (e) { if (e.success) { var u = e.users[0]; var S = 'user :'; for (i in u) { S += '\n'+i+':'+u[i]; if (i === 'photo') { S += '\n'+i+':'+u[i].urls.original; } } alert(S); } else { alert('Error: ' + ((e.error && e.message) || JSON.stringify(e))); } });The result is success but does not update the image. I am guessing that I am not passing the correct format to the cloud with
readAsDataURL