Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

SimplifiedUpload and MD5Hash
Last Post 09/25/2008 12:29 AM by Peter Donker. 4 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Marc
New Member
New Member
Posts:6


--
09/22/2008 1:21 AM

Hi,

I am uploading a directory of files to DMX using EntriesController.SimplifiedUpload. All is working fine, I can see the files in DMX, but for some reason all files have the same MD5Hash value even when they are all different. Is there anything I need to do to make sure the MD5Hash value is correct?

Here is the code I am using:

Dim di As New DirectoryInfo(_imagesPath)
Dim fiList As FileInfo() = di.GetFiles()

For Each fi As FileInfo In fiList

...

  fs = New FileStream(fi.FullName, FileMode.Open)
  uploadedEntryId = EntriesController.SimplifiedUpload(_portalId, _
    imagesCollectionId, fs, fi.Name, fi.Name, _
    UserController.GetCurrentUserInfo, False)

...
Next

Marc
New Member
New Member
Posts:6


--
09/22/2008 3:52 PM

Just forgot to mention:
DNN 4.6.2
DMX 4.3.2

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
09/23/2008 11:05 AM
Hi Marc,

It looks like the MD5Hash is not calculated correctly on an io.stream. For now it is not something to worry about as DMX does not yet use the hash. As soon as this is brought into play, this will need to be fixed.

Peter
Marc
New Member
New Member
Posts:6


--
09/24/2008 2:37 PM

Hi Peter,

Thanks for your reply but since we need the MD5Hash (to detect multiple uploads of the same file under a different name) we implemented our own code with the following logic:

  1. Calculate MD5Hash with DMX.Common.Hash.ComputeFileHash(filename)
  2. Check if entry exists in DMX_Entries within a collection and any subcollections on the basis of the filesize, filetype and MD5Hash (developed our own stored procedure for it)
  3. If it does not exists
    1. upload document to DMX with SimplifiedUpload
    2. use the EntryId returned from the previous step to get the entry with EntriesController.GetEntry
    3. set the MD5Hash field to the value calculated in step 1
    4. call EntriesController.UpdateEntry

This works ok for us and as expected the MD5Hash is the same as when the document was uploaded using the "New Item..." dialog. There is a small overhead so it would be better if SimplifiedUpload would set the MD5Hash in a future release.

Thanks,

Marc

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
09/25/2008 12:29 AM
It has already been added to the bug tracker ...

Cheers,

Peter

PS See you at OF/EU in just over a week's time
You are not authorized to post a reply.