221
Views
6
Comments
Display image from Path
Question
Good day, I have attached a .oml file. what I'm trying to do is to display an image in the table using the <img> tag. I have done everything I can and it seems that I'm not getting anywhere. I also tried using the Image widget but with the same effect. Can anyone help me with this? Thank you in advance.

Regards,

Patrik Potestad
FileUploadDownload.oml
2012-03-16 12-21-09
João Rosado
Staff
Hi Patrik,

Is there any reason for trying to save/read the images from disk?
I think you main problem there is not having the "file://" protocol on the url.
But you will be having security issues, would at max work in localhost and on some browsers.

I recommend you to use database images.
On the upload insert the image binary to the database.
Use the Image Widget with Type "Database".

Also, it is never a good practice to use Advanced Queries to do inserts.
Use the Create or the CreateOrUpdate action of the entity.


Regards,
João Rosado


UserImage.jpg
Patrik Potestad
Thank you for the tip.  I'm quite new to agile platform... But is there a way to display the the image from a saved path from the database using the expression widget?  my clients require that only the path to the image should be saved and not the whole image. Again, thank you in advance..
2020-10-15 10-24-31
Miguel Seabra Melo
Hi Patrik,

Welcome to the forums!

Unfortunately it is not possible to retrieve the full path of an uploaded file using the Upload widget so that you can save it to the DB. See the following post for the reason why:

https://www.outsystems.com/NetworkForums/ViewTopic.aspx?TopicId=9046&Topic=file-pick-up#Post28333

In any case, as João pointed out, this operation probably doesn't make much sense anyway because this path would be IN THE COMPUTER OF THE PERSON ACCESSING YOUR APPLICATION AT THAT MOMENT so any other user on another computer would not be able to retrieve it later.

Cheers,


Miguel
2025-11-03 12-56-18
Evert van der Zalm
 
MVP
Hello Patrick,

Maybe this post is usefull for you: FileSystem.

Kind regards,
Evert
2012-03-16 12-21-09
João Rosado
Staff
Hi Patrik,

Well, it's possible. Even though I still think database images would be a better option.
But try to stay away of  unescaped expressions as much as possible, and stick with Image Widgets with type "External".

For it to work you need a URL that is valid over the internet. "C:\ ..." is not a valid url.
But, you can save the images to that folder and then have the folder manually mapped as a Virtual Directory in IIS.
  • That way, you save the images to the disk to a folder "C:\something\image.jpg", save on your table the relative path to your image "image.jpg".
  • Then go to your IIS and create a virtual directory to map that folder (google how to do that, if needed). Remember that the user that runs IIS will need permissions to access that folder.
  • For this example lets say the virtual directory you create is called "Images"
  • On the Image Widget url set it to "/Images/image.jpg"
Hope this helps.

Regards,
João Rosado
UserImage.jpg
Patrik Potestad
Thanks for the tip. That helped me a lot

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