The image upload handle is correct.
but I can’t display images.
Is it similar to?
For example Pimage has next value.
.Pimage = “./template-images/p1.jpg”
And the image exist in template-images directory.
and It doesn’t show the image.
You need to show how you serve static files and how your template looks like.
But basically you just need to create a IMG tag with a src attribute pointing to the URL on your server that maps to the static file.
Thank you. I wrote img tag and src attribute. but it deleted automatically, when I post topic.
Then repost. And please remember to annotate code and codelike snippets accordingly using markdown syntax:
This `inline` code
// And this is a block of go code
I just found the solution.
http.Handle("/temp-images/", http.StripPrefix("/temp-images", http.FileServer(http.Dir(“temp-images/”))));
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.