Page 4 of 5

How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Mon Jun 15, 2015 3:54 pm
by Joe Sharples

Hi Yurii,
Thank you for you're time and detailed description, it has helped a lot.
just one more quick question.

I followed the steps and I get the result:
[{"success":{"filename":"bd7d7d8a-b449-4de0-a228-46e18fd5c857.myFile.png","fileurl":"https://api.appery.io/rest/1/db/files..."}}]

how would I save the "fileurl" to localstorage from this result?


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Wed Jun 17, 2015 4:21 am
by Yurii Orishchuk

Hi Joe,

For example you can add "success" js event handler to this service with following JS code:

pre

for(var i = 0; i < data&#46;length; i++)
localStorage&#46;setItem("lsvName", data&#46;fileurl);

/pre

Regards.


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Wed Jun 17, 2015 11:56 am
by Joe Sharples

Hi Yurii,

I tried your code on success:
Image

it didnt work.
I added, console.log("fileurl success test");
this didnt show in the console.

so i tried adding the code to success in the js on button click:

pre

var fileName = "myFile&#46;png";
var FDU = fileDataUrl64;
var FDUreplaced = FDU&#46;replace('data:image/jpeg;base64,','');

var base64Content = FDUreplaced;
var fileBlob = b64toBlob(base64Content, "image/png");
var data = new FormData();
data&#46;append(fileName, fileBlob);
var onSuccess = function(data){

Code: Select all

 for(var i = 0; i < data&#46;length; i++){ 
 localStorage&#46;setItem("TestfileURL", data[i]&#46;fileurl); 
 } 

alert(JSON&#46;stringify(data));
};
&#47;&#47;Where "uploadService2" is your updload service datasource name&#46;
uploadService2&#46;execute({
'allowDataModification': false,
'processData': false,
'body': {data: data},
'cache': false,
'success': onSuccess
});
/pre

after button click, "TestfileUrl" local storage is "undefined".


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Wed Jun 17, 2015 11:57 am
by Joe Sharples

but the alert still showed the file uploading successfully


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Mon Jun 22, 2015 12:00 pm
by Joe Sharples

Is there a limit to the file size?


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Wed Jun 24, 2015 2:52 am
by Yurii Orishchuk

Hi Joe,

Please show us browser debugger network tab where we can see request/response on this upload service.

Thanks.


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Mon Jul 06, 2015 4:29 pm
by Joe Sharples

request:
Image

response:
Image


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Tue Jul 07, 2015 1:17 pm
by Joe Sharples

figured it out!

it should have been:
codelocalStorage&#46;setItem("TestfileURL", data&#46;success&#46;fileurl);
/code

not:
code
localStorage&#46;setItem("TestfileURL", data&#46;fileurl);/code


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Thu Jul 09, 2015 11:35 am
by Joe Sharples

Is there an easy way to reduce the image quality?

The image a user uploads is only displayed at a thumbnail size of around 80px wide.
The average image upload from the device camera is around 2.5-4MB. It doesnt need to be this large when only viewed with an 80px width.

how can I change the file size or image quality?

Thanks for all your help.


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Fri Jul 10, 2015 1:30 am
by Yurii Orishchuk

Hi Joe,

Yes, you can set this image into canvas and then make needed manipulations(for example resize) and get base64 source of this changed image.

Please read more details here: http://stackoverflow.com/questions/23...

Regards.