java - Checking for a Valid Path when Uploading a File Using commons-fileupload -


I am working with a code that uploads an image from a form and stores it on our servers In Internet Explorer the user can manually enter the path, and I wonder how I can see that the file exists, i.e., the user has entered a valid path.

There is a file unit object that is being used to check size (for example, fileItem.getSize ()

  if (fileItem.getSize () == 0) {// Some are wrong- invalid path. } Else {// file exists - valid path}  

Any suggestion is appreciated. Thanks!

On the client, you can not read the text of the file upload control trustably with the script. For example IE8 and Opera 10 will lie to you and provide a common path containing "C: \ forgiveness \". This is done for privacy reasons.

On the server, you can do the same way you did, just check to see that you got the file in the upload, and if so, you can check the file, set Make sure that it matches your criteria.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -