• Post Reply Bookmark Topic Watch Topic
  • New Topic

FileOutputStream exception

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am doing application where i want to store file in images folder under my project directory. iam also changing the file name with attributes taken from seesion. I am taking context path using request.getContentType()
I am not able save the file using FileOutputStream

i am attching my code

I am ussing concat var to rename file .tts will be it extension
now i want to save this new file in images folder
but i get Exception





output

url===/Silicon_new/images
filename==jeetu@kpit.com 3.tts relative path==/Silicon_new/images java.io.FileNotFoundException: \Silicon_new\images (The system cannot find the path specified) done
--------------------------------------------------------------------------------
 
Rajakumar Anantharam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. you are trying to open output stream for a folder, you did not append fileName to turl.

2. Try creating the directory "\Silicon_new\images" on your root directory and append the fileName to turl and run the app. You should see the file created properly. (I am sure this is not what you want, but your code trying to do this only).

3. you are trying to use context path as physical file path which is not possible. Read some docs on webapp folder structures and how webapp deployment works. Make sure you read your web-server specific docs, because they are vendor specific.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!