views:

51

answers:

2

With LLVM and silverlight this may be possible now (or it may be possible with flash).

I like the user to select a file and then do the following things 1) Hash it with md5 and sha1 2) If archive check if an exe is in it 3) If archive check if password protected

The first to see if the user has uploaded it already (today, yesterday, last month) 2nd to prevent viruses 3rd i should be fine without but if i decide to not allow protected archives i can warn before the user uploads it.

How may i do this through the browser?

+1  A: 

You can do this across lots of platforms with Java or Flash.

If you only care about doing it on Windows you can do it with those 2 or Silverlight, an embedded WPF page, an embedded Windows Forms page or an ActiveX control.

Arnshea
Do you know much about Silverlight? can i run code without notifying the user like flash does but unlike activeX where you need to run unsafe code and request the user to DL?Can i use .NET libs with Silverlight? i am hoping i can use sevenzip or something similar to check the contents of the zip or rar file.
acidzombie24
haven't done a ton with Silverlight but once they've installed the plug-in (which they'll be asked to do if they don't have it) then it'll run on a page automatically just like flash.
Arnshea
+1  A: 

You can use the in-progress HTML 5 File API. Look at FileReader.readAsBinaryString in particular. However, I would consider it a waste of time in this case. You would have to redo all these checks on the server anyway (never trust the client).

Matthew Flaschen
This is why i hope silverlight or llvm can do it. I hear mono can compile .net code to LLVM so C# on serverside can be used as code on client side with either.
acidzombie24
@Acid, if you use any client side validation (HTML, Silverlight, Flash, whatever), you have to validate twice. This adds unnecessary delay while providing little benefit, since presumably the large majority of uploads will be valid. Client side validation is most useful for quick tests on accident-prone fields.
Matthew Flaschen
depending on the user speed and size of file it could take >20mins to find out you uploaded a zip with an exe or be surprised that the site does not allow passwords on archives.
acidzombie24