How to set the image URL after the upload?

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

How to set the image URL after the upload?

#1

Postby t4nu » Tue Feb 16, 2016 12:35 pm

Hi,
I tried to set the image URL file from the within the script but until now still fail.
I set the upload To Directory to ./ebasetest/uploadedFiles

and from within the script I do like this:

Code: Select all

	form.uploadFileFromBrowser();
	controls.imgApplicantPhoto.imageURL = system.variables.$FILE_NAME.value;
but the image still show nothing.

How can I solve this problem?

edit:
I have tried this too, with the same result (image not shown):

Code: Select all

	controls.imgApplicantPhoto.setImageURL(system.variables.$FILE_NAME.value);
	controls.imgApplicantPhoto.refresh();
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Tue Feb 16, 2016 2:24 pm

The URL for an image and its file path are not quite the same thing. For example:

If I upload an image, its file path returned in system.variables.$FILE_NAME.value will be something like:
  • C:/mydir/UfsServer/tomcat/webapps/ebase/uploadedfiles/image.gif
..but the url to display this image is relative to the root of the web app and will be:
  • uploadedfiles/image.gif
So you need to manipulate the path to translate it into a URL
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#3

Postby t4nu » Wed Feb 17, 2016 2:51 am

OK. IC.
Is there a way for me to get the root folder of the web app or upload to directory that set in the server admin app?
Jon wrote:The URL for an image and its file path are not quite the same thing. For example:

If I upload an image, its file path returned in system.variables.$FILE_NAME.value will be something like:
  • C:/mydir/UfsServer/tomcat/webapps/ebase/uploadedfiles/image.gif
..but the url to display this image is relative to the root of the web app and will be:
  • uploadedfiles/image.gif
So you need to manipulate the path to translate it into a URL
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Wed Feb 17, 2016 9:08 am

Is there a way for me to get the root folder of the web app
FileServices.getWebAppRootFilePath()
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#5

Postby t4nu » Wed Feb 17, 2016 9:50 pm

Thank you.
Jon wrote:
Is there a way for me to get the root folder of the web app
FileServices.getWebAppRootFilePath()
0 x


Who is online

Users browsing this forum: No registered users and 13 guests