Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4076944
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:29:20+00:00 2026-05-20T17:29:20+00:00

This question may be stupid, but I don’t really see how to resolve it

  • 0

This question may be stupid, but I don’t really see how to resolve it :
let’s say that in my application, I have a user. This user edit his profile, and need to edit his avatar.

Where should I store the avatar file?
first of all I was saving all the files in src\main\webapp\resources, but each time I redeploy that folder empties.

So I decided to place in another location : c:\wwwdir\resources, but I can’t link local resources from remote pages, so I was not able to display any avatar .

Any idea? advise? link?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:29:21+00:00Added an answer on May 20, 2026 at 5:29 pm

    Things to consider before coming to a solution:

    • Will you be horizontally scaling your webapp (i.e. will you be running multiple servlet container instances).
    • What kind of traffic are you expecting?
    • How quickly does the image need to update (i.e. after a user changes their avatar, should they and all other users see the new avatar immediately).

    For a webapp that is not horizontally scaled, you can use the file system as your image store. This is simple, understandable, and works.

    For webapps that are horizontally scaled, you will need to store your images in a place that each servlet container can reach. This could be a database (I don’t recommend this), S3 (I recommend this), or a content repository (I’ve never used one of these). One advantage of S3, is that it scales well. You can put it behind CloudFront (Amazon’s CDN), or simply server off of S3 and keep the load off of your servers.

    You also mention in your question that you can’t server local resource from remote clients. This is correct, kind of… I’m guessing you’re trying to use some URL like file://c:/.../image.jpg. This won’t work. What you need to do is map a handler to serve up the image. This might look something like

    @RequestMapping(value = "/image/{name}.jpg", method = RequestMethod.GET)
    public void image(@PathVariable("name") String name, HttpServletResponse response) {
        // Read the image from the file system using java.io
        // Write the image to the response output stream
        // Even better use org.springframework.utils.FileCopyUtils
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question may seem completely stupid, but say i have a PHP page with
This may be a stupid question, but I have to ask! I have the
Ok, this may seem like a stupid question (for Flash Developers) but I really
This may be a stupid question, but I'll feel stupider if I don't ask
This question may be a stupid question, but I'm really curious. After playing games
This may be stupid question, but I am looking at Ninject sources and don't
I am new in programming and this question may really be stupid but I
This question may seem stupid, but, so be it! I have a stupid problem
This may be a stupid question, but it's something that bugs me on a
This may be a really stupid question, but I cannot find anything anywhere as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.