Why If I upload a picture Spring Boot searches in my computer?

user14977859

I am building a spring boot application in which, at a certain point, the user has to input a file (image, text or whatever he wants) and this file is eventually going to be auto-sent to me by mail. I have used this, in my HTML template, to ask for the output;

<div class="custom-file">
 <input type="file" class="custom-file-input"
                        name="6?-BBtn9E@=G8Yua" id="6?-BBtn9E@=G8Yua"> <label
                        class="custom-file-label" for="6?-BBtn9E@=G8Yua">Select file</label>
                </div> 

As you can see I'm using bootstrap.

In my spring boot controller I'm getting that param this way;

@RequestParam(name = "6?-BBtn9E@=G8Yua", required = false) File userFile

Then the mail is going to be sent regularly (I've previously tested the mail-sending worked, when I still hadn't this file input issue), hence I'm just going to show you the attaching;

HtmlEmail email = new HtmlEmail();
email.attach(userFile);
email.send();

However, when I submit, I get this IOException in the console;

java.io.IOException: "/Users/username/Eclipse-Workspace/Website/file.txt" does not exist

I've picked up a file called file.txt, and since I'm running this on a mac computer the path is /Users/{myUsername}/{Eclipse-Workspace}/{Spring-Boot-Project/{file-name}. What I want is that Spring Boot searches out of the project, not just inside of it.

Why is it doing so? Thanks for reading!

k-wasilewski

When you want Spring to look outside the project folder you want: "file:/Users/username/Eclipse-Workspace/Website/file.txt".

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Java FXML: Why is my imageView not Showing, and how can I upload an image from my computer?

Why I get an error when I try to upload a picture

How do I upload a picture to my blog using the Django administration

Why am I not able to get my Bean definition available in my Spring context with Spring Boot?

Why is Crashplan so slow to upload my computer's files?

Spring boot is throwing my custom exception in my service unit test yet I see no reason why it is doing that

I can hear my computer, Why is that

Spring Boot / JPA: Why would war conversion break functionality and/or JPA searches?

External drive doesn't boot on my computer, does when I boot in my college computer lab

Why I m still getting data from my webflux spring boot even if I unsubscribe?

Why I can not upload file to my database?

Why I can't handle multipart upload in this Spring Boot application? I obtain "no matching editors or conversion strategy found"

Why isn't my computer turning on past boot screen?

Why won't my computer boot (first time)?

Why does my computer sometimes boot up faster or slower?

Can't figure out why my computer won't boot

Why is spring boot not finding my beans?

why is my form not passing information in spring boot

Why I' m Getting Below SpringIntegration Exception while running my application with spring boot

Why can I run my app VSCode but not correctly in CLI?, its a spring boot application

Spring boot -> why i dont need to catch my exceptions inside a service?

Why do searches redirect to “SuddenLink.net”, instead of my default browser search engine? Can I prevent this?

How do I change which monitor my computer uses at boot?

How to get the IP of the computer, of searches in my google account?

Why do I get a "405 - Method Not Allowed" error when trying to open a .css file in my Spring Boot/Spring Security web app?

How can i upload a video and a picture at the same time to a server using php and my sql

I want to upload some picture files to my server and record the file name in mysql database but somehow there exists a problem

How can I increase maximum file upload in Vaadin - Spring Boot

How to upload my project to github from my computer. I have a project created which is loacted on Desktop

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  7. 7

    Do Idle Snowflake Connections Use Cloud Services Credits?

  8. 8

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  9. 9

    Binding element 'string' implicitly has an 'any' type

  10. 10

    BigQuery - concatenate ignoring NULL

  11. 11

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  12. 12

    In Skype, how to block "User requests your details"?

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Pandas - check if dataframe has negative value in any column

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Generate random UUIDv4 with Elm

  17. 17

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  18. 18

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  19. 19

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  20. 20

    EXCEL: Find sum of values in one column with criteria from other column

  21. 21

    How to use merge windows unallocated space into Ubuntu using GParted?

HotTag

Archive