} My problem is iam getting the following exception...at the following line in my above code dir1.createNewFile();
R java.io.IOException: The system cannot find the path specified. [12/18/08 9:43:24:347 CST] 00000021 SystemErr R at java.io.WinNTFileSystem.createFileExclusively(Native Method) [12/18/08 9:43:24:347 CST] 00000021 SystemErr R at java.io.File.createNewFile(File.java:876) [12/18/08 9:43:24:347 CST] 00000021 SystemErr R at germania.gwp.beans.PhotosUploadBean.upLoad(PhotosUploadBean.java) [12/18/08 9:43:24:347 CST] 00000021 SystemErr R at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
That's an IE-proprietary mimetype. The valid mimetype is "image/jpeg". Don't make your webapp that dependent on a single webbrowser which doesn't respect the web standards at all. Rather check if the content type ends with "jpeg", or, maybe better, starts with "images". There are more image types than only jpg.
dir1.mkdir(); //Create directory
It only tries to create the last directory. Maybe you need mkdirs() instead? Those methods returns a boolean by the way. Have you checked it?