Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to add custom "File Name" to an image/file being uploaded?

Dear xman,

In this case you need:

1 In service "file upload" link - "fileurl" response parameter to some LSV.(for example "fileUrl").

2 Use following JS code to set this file asset to image component on event and page you need:

pre

//Note: you need use here LSV from 1st step.
var fileAsset = localStorage.getItem("fileUrl");

Appery("picElementName").attr("src", fileAsset);

/pre

That's all.

Regards.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

How to add custom "File Name" to an image/file being uploaded?

Hi Yurii, wouldn't that cause problem because next user when uploads a file will end up overwriting this LSV and mess up the previous users picture?

So, what I was trying (as mentioned above and in discussion in this thread) was to store picture with a unique prefix (so that I now the filename). Then use that filename to get the image path. Then use that image path/URL to display the image. But that has not worked, it shows a thumbmail but no picture. Not sure if it's access right issue, but I have not done anything specific to the file access.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

How to add custom "File Name" to an image/file being uploaded?

I'm still stuck. Looking forward into it this is what I have:

b[/b] The file upload service returns the following "fileurl" for the file "sub_paradigmaLogo.png" just uploaded. If I use this fileurl the file is displayed correctly:

https://api.appery.io/rest/1/db/files...

b[/b] My requirement is that I should be able to get the path of the image uploaded and then display it on other page - as localStorage will get overwritten by other user loggin in. So, I use imagepath:

Appery("pageName").attr("src",Appery.getImagePath("sub_paradigmaLogo.png"));

...which returns the following URL for the same image that was uploaded via fileupload (and this url does not not display the image)

http://appery.io/app/view/e339e22c-ad...

Why are the file URLs different for the same file? Why the second is not working?

-

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How to add custom "File Name" to an image/file being uploaded?

Hello,

Sorry for delay. We need additional time. We'll let you know as soon as have updates.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

How to add custom "File Name" to an image/file being uploaded?

I have a deadline tonight, any chance to hear back before that and still have time to meet the deadline?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to add custom "File Name" to an image/file being uploaded?

Hello,

Your second option works if an image file what name you take from a localStorage variable is stored as an asset inside of your app (i.e. it's uploaded via Media Manager).

As you take it from Database you should use the following URL then:prehttps://api.appery.io/rest/1/db/files/53785372e4b0b8a66d8da855/6d1554b2-74c2-495f-ae73-ad1453fd7019.sub_paradigmaLogo.png/pre

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

How to add custom "File Name" to an image/file being uploaded?

Katya, I don't understand what you are trying to convey. The users of my app will not use media manager, they'll use the app to upload the image. What I need is imagepath to return me the right path to the file uploaded into the Files predefined type.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to add custom "File Name" to an image/file being uploaded?

As they will upload images to Database you can use a URL like the above...

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

How to add custom "File Name" to an image/file being uploaded?

...and how am I going to get that URL for each picture user uploaded (event pictures and profile pictures) if imagepath is not working?

Return to “Issues”