Thanks for the reply Jim

I am using Zinc and have managed to get it working so I can drag and drop
the file onto the application.

I have found a MD5 class now but the value it is giving me does not match
the value the client is comparing it against.

Here is a snippit of my code

ByteLoader = new URLLoader();
ByteLoader.dataFormat = URLLoaderDataFormat.BINARY;
ByteLoader.addEventListener (Event.COMPLETE, loadFileComplete);
                                                
FileRequest = new URLRequest (passed_File_Path);
ByteLoader.load (FileRequest);

}
        
        
public function loadFileComplete(event:Event){
                
    trace ("loadFileComplete");
                
    var md5Value = MD5.encrypt (ByteLoader.data); 

This is the MD5 Class

http://gsolofp.blogspot.com/2006/01/actionscript-3-md5-and-sha1.html

Any idea why I am not getting the same MD5 value? Is it something to do with
how I am reading in the file data?

Thanks

Paul 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jim Cheng
Sent: 31 August 2007 00:32
To: [email protected]
Subject: Re: [Flashcoders] How to get the MD5 hash value of a file

Paul Steven wrote:

> Is there a built in function that will provide me with the MD5 value for a
> file? I have seen some examples online that provide a MD5 value for a
string
> but I need it for a file.

Nothing built in, though if you can read the file into a ByteArray, it's 
fairly simple to modify one of the existing MD5 hash routines to take in 
a ByteArray instead.  For example, if you were using the open-source 
as3corelib project's MD5 class you can just change in the parameter type 
to a ByteArray, and then modify the createBlocks() method to do the same 
and read in the i'th byte rather than calling s.charCodeAt().

However, there's a big caveat--unless you're planning on doing this from 
an Adobe AIR (formerly Apollo) application or a third-party projector 
(e.g. Zinc, SWF Studio, SWHX and the like), you're probably out of luck.

As far as I know neither the standalone or plugin Flash Player, nor the 
standard web browsers allow programmatic access to client-side files 
scheduled for upload--typically, you'd need to have the user actually 
upload them and then round-trip the file back from the server to have 
access to the content. :(

You might be able to do it via an ActiveX control or a Java applet that 
has the appropriate permissions, though this may require an additional 
dialog requesting the user to grant escalated privileges.

Jim
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to