540
Views
4
Comments
[File Plugin] Upload file from phone storage
Question
file-plugin
Mobile icon
Forge asset by OutSystems

I'm trying to create an app which requires uploading of a photo. I've seen the File Plugin, but am unable to understand it. I want it to display some phone storage folder from where the user is allowed to choose an image. Is this possible?

2020-12-15 11-23-41
César Afonso
Staff

Hello Saurav.

If you want to allow the user to choose from the phone's gallery, the Camera Plugin allows this by changing the default parameters in the TakePictureJS:

Looking at the Camera Plugin documentation:

"If Camera.sourceType is Camera.PictureSourceType.PHOTOLIBRARY or Camera.PictureSourceType.SAVEDPHOTOALBUM, then a dialog displays that allows users to select an existing image."


Thanks

2018-04-09 09-32-27
Neville Campher

Can you please provide more detail on this ow to access the camera photos already taken before, I I look in m JS it is listed as below on ver 5, Where do I need to make the changes


navigator.camera.getPicture(function(imageData) {
    $parameters.Success = true;
    $parameters.ImageCaptured = imageData;
    $resolve();
}, function (message) {
    $parameters.Success = false;
    $parameters.ErrorMessage = message;
    $parameters.ImageCaptured = "";
    $resolve();
}, {
    quality: 60,  destinationType: Camera.DestinationType.DATA_URL,
    encodingType: Camera.EncodingType.JPEG, targetWidth: 600,
    targetHeight: 600, correctOrientation: true
});

2020-12-15 11-23-41
César Afonso
Staff

Hello Neville.

You need to pass another parameter. Something like:


navigator.camera.getPicture(function(imageData) {
    $parameters.Success = true;
    $parameters.ImageCaptured = imageData;
    $resolve();
}, function (message) {
    $parameters.Success = false;
    $parameters.ErrorMessage = message;
    $parameters.ImageCaptured = "";
    $resolve();
}, {
    quality: 60,  destinationType: Camera.DestinationType.DATA_URL,
    encodingType: Camera.EncodingType.JPEG, 

    sourceType: Camera.PictureSourceType.PHOTOLIBRARY,

    targetWidth: 600,
    targetHeight: 600, correctOrientation: true
});


More info on the documentation. Let me know if it helps.

Thanks

2019-11-08 16-23-42
César Mateus Conceição

Can we upload a multiple images using a mobile upload widget ?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.