I am doing project of shopping cart.. in which admin can log in and add the product to his site.. so how to add jpg file of the product on the server.. for copying image I am using FileInputStream and FileOutputStream. but what path should I give to upload file on the server .. suppose I stored images on web-apps\ShoppingCart(projectName)\Images(folderName).
I am using apache web server..
suppose there is file named Laptop.jpg on my desktop.. and I logged in as an admin. so I am giving path to upload file Images/Laptop.jpg... but its giving me an error
SCJP 6 (88%), SCWCD 5 (78%), preparing for SCBCD
Joined: Oct 08, 2006
Make use of ServletContext#getRealPath() to convert a relative web path to an absolute file system path which you on its turn can use in File/FileInputStream.