I'm working with some code that uploads an image from a form and stores it on our server. In Internet Explorer the user can enter a path manually, and I wonder how I can check that the file exists, i.e., that the user entered a valid path.
There's a FileItem object that's being used to check size (e.g., fileItem.getSize() < MAX_SIZE), and I wonder if a good approach would be to use size to check that the file exists. For example:
if (fileItem.getSize() == 0) {
// Somethings wrong -- invalid path.
} else {
// File exists -- valid path.
}
Any suggestions are appreciated. Thanks!