Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

 1 Answer(s)

  • Hi, You can use cordova camera plugin, you can refer to one of our blog:
    How to use cordova camera plugin


    If you want to send image as base64 string you can change destination type to Camera.DestinationType.DATA_URL and you can send imageData to server via ajax call.
    or, if you want to send as file array then keep the same destination type to camera.DestinationType.FILE_URI and use cordova file plugin to send file data in server:

                var options = new FileUploadOptions();
                options.fileKey="tickitFile";
                options.fileName=imageData.substr(imageData.lastIndexOf('/')+1);
                options.contentType = "multipart/form-data";
                options.chunkedMode = false;
                options.mimeType="image/jpeg";
                options.httpMethod="POST";
                options.headers =   {
                                        Connection: "close"
                                    };    
    
    
                var ft = new FileTransfer();
    
    
                ft.upload(imageData, PHP_URL, win, fail, options);
                function win(r) {
                    console.log("Response = " + r.response);
                       console.log("Sent = " + r.bytesSent); 
                }
                function fail(error) { 
                    console.log(JSON.stringify(error));
                } 
    


    Hope this will help you.. :)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: