Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Checking file contents before uploading  RSS feed

 
Ajil sa
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

My requirement is to upload a file from client(browser) to my Application Server (In any directory of Application Server machine like C:\ or D:\ etc..). But before that I want to check whether the file has any data or no ?

But on clients machine I cant do File operation using java.io package.
Can anyone tell me how can I read file temporary without uploading it on server and check if file has any data so that I can give message to client like File has no data.

Thanks in advance.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a suspicious activity.

You should not attempt to read files on client machines from server code.

Have user upload file and if it is empty, then send message to client about the empty file. This is a better option, in my opinion.
[ October 06, 2008: Message edited by: James Clark ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!