I am developing a web application where I want to get image from user.
So I wrote a Servlet
to get file path from user. I'm passing file path as...
localhostApiBase/image?path=/home/userName/Pictures/25.jpg
I deployed my application on localhost and Its working fine. i.e. my application found the file and processed as intended. I'm reading image like this
File oFile = new File(path);
BufferedImage oImage = ImageIO.read(oFile);
Then I deployed my application to AWS Elastic Beanstalk, and when I'm trying to hit the same Servlet
with same path as....
serverApiBase/image?path=/home/userName/Pictures/25.jpg
then
File oFile = new File(path);
oFile.exists(); // returns false
BufferedImage oImage = ImageIO.read(oFile); // throws java.nio.file.NoSuchFileException: /home/userName/Pictures/25.jpg
After some efforts I came to know that it is trying to find file on server (AWS Elastic Beanstalk)
not on my (user's) local machine. So it is throwing
java.nio.file.NoSuchFileException .
Can anyone help me solve the issue. I want users to upload images from their machine, which I will use further....