-
Capturing and Uploading Video to PHP Server in Cordova
about 9 years ago
-
about 9 years ago
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.. :) -
1 Answer(s)