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 Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Checking common files for password protection  RSS feed

 
Tom Simmons
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Morning All

I'm not trying to gain access to files here, what I need to do is simply check files that people are uploading to make sure that they don't have a password. File types are the common ones, i.e. Word, Excel, PDF etc.

Currently I use Neevia, but this requires reading the entire file into memory and I'm dealing with files that can easily be 200MB plus, so it takes a damn long time.


Thanks for any help...


Tom
 
subhash kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am not aware what Neevia is.
But as java gives canRead() method in File class
there might be some provision to check if the file is readable or not
if it is passing this test, you can continue with the uploading.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File.canRead checks whether the current process is allowed to access a file - it is not about file content at all.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!