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

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!
I think you don't even get a FileItem when there is nothing uploaded.

以上就是Checking for a Valid Path when Uploading a File Using commons-fileupload的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准