Plupload: how to download directly from the camera (to mobile devices)

I use Plupload so that users can upload images to my WordPress website.

When the user clicks the โ€œSelect Filesโ€ button and selects an image from his gallery of mobile phones, the image file name appears on the screen. Then the user can click "Download Files" to start the download.

My problem

When the user clicks โ€œSelect Filesโ€ and takes a photo using his camera phone, the image file name does not appear on the screen. In this case, when the user now tries to click "Download Files", nothing happens. How can i solve this?

Notes

The problem does not occur when I use my tablet or desktop.

Update

My testing was done using two mobile devices:

  • Chrome on the Samsung Galaxy S4 Mini is running Android 4.2.2.
  • Chrome on Samsung Galaxy Ace II is running Android 4.1.2.

Here is an example of the code I'm using: http://jsfiddle.net/djydce90/

My script

var uploader = new plupload.Uploader({ runtimes : 'html5,flash,silverlight,html4', browse_button : 'pickfiles', container: document.getElementById( 'container' ), url : "/examples/upload", filters : { max_file_size : '10mb', mime_types: [ {title : "Image files", extensions : "jpg,gif,png"}, {title : "Zip files", extensions : "zip"} ] }, flash_swf_url : '/plupload/js/Moxie.swf', silverlight_xap_url : '/plupload/js/Moxie.xap', init: { PostInit: function() { document.getElementById('filelist').innerHTML = ''; document.getElementById('uploadfiles').onclick = function() { uploader.start(); return false; }; }, FilesAdded: function(up, files) { plupload.each(files, function(file) { document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>'; }); }, UploadProgress: function(up, file) { document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>"; }, Error: function(up, err) { document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message; } } }); uploader.init(); 

My html

 <script src="https://rawgit.com/moxiecode/plupload/master/js/plupload.full.min.js"></script> <div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div> <br /> <div id="container"> <a id="pickfiles" href="javascript:;">[Select files]</a> <a id="uploadfiles" href="javascript:;">[Upload files]</a> </div> 

Link: http://www.plupload.com/examples/core

+7
javascript php file-upload wordpress plupload
source share
1 answer

The problem arises from the image capture method. Android gives you a bitmap when you take rice, so you need to load this bitmap, not the file. When you select a file from your memory, it will send you this path, but in the process of capturing you give the photo data in detail. so you need to download this data with photos, and not upload the file. I do not know for sure whether pluplaoad can handle this or not, but you can go through this link to get an idea about this.

+1
source share

All Articles