Forums Register Login

find uploaded file from upload

+Pie Number of slices to send: Send
Hi, I'm fairly new to programming. Now Im working with java backend and servlets where I will upload a file and display it on a servlet side.And this is surely a stupid question but I just have to ask. I have uploaded the file and it prints the pathname in the console, but when I go to the location I can not find the file. What am I doing wrong? and how can i set a folder as desired area where the files should be uploaded?
Thanks!!

Html code:



Servlet:

+Pie Number of slices to send: Send
It looks to me like your code gets the path of the file from the client machine, but then looks for that file on the server machine instead. And naturally it isn't there.

So that isn't how file uploads work. Your upload servlet can't just store the path where the file came from on the client machine, because it won't be able to access the file from there. It actually has to store the contents of that file (which are part of the upload) somewhere on the server. For more (and better) information have a look at our Servlet FAQ entry FileUpload.

+Pie Number of slices to send: Send
Ahhh of course.Thank you very much!!;)
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4767 times.
Similar Threads
Problems with file upload
take in file from client machine
HTTP Status 405 - HTTP method GET is not supported by this URL
Uploading file in a database
getting the uploaded filename for downloading
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:01:01.