• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

find uploaded file from upload

 
Louise Blue
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Louise Blue
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhh of course.Thank you very much!!;)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic