You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am using ng-file library to support upload of files.
I have an issue relating to binary files that is described at the following issue: DockerSecurityPlayground/DSP#51
In order to troubleshoot, I try to log md5sum of a binary file.
When I upload a binary file, I perform the following operation:
<div class="modal-body" id="modal-body">
<div class="btn btn-default" ngf-select="upload($files)" ngf-multiple="true">Add File</div>
Drop File:
<div ngf-drop ngf-select ng-model="files" class="drop-box"
ngf-drag-over-class="'dragover'" ngf-multiple="true" ngf-include-dir="true" ngf-allow-dir="true"
>Drag and Drop file</div>
<div ngf-no-file-drop>File Drag/Drop is not supported for this browser</div>
<!-- Files: -->
<!-- <ul> -->
<!-- <li ng-repeat="f in files" style="font:smaller">{{f.name}} {{f.$error}} {{f.$errorParam}}</li> -->
<!-- </ul> -->
Upload Log:
<pre>{{log}}</pre>
Controller ->
$scope.upload = function (files) {
if (files && files.length) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
_manageUpload(file);
...
function _manageUpload(file) {
_getFileContent(f, function(err, data) {
....
}
function _getFileContent(f, cb) {
var reader = new FileReader();
// reader.readAsText(f, "UTF-8");
reader.readAsBinaryString(f);
reader.onload = function (evt) {
var md5Hash = CryptoJS.MD5(evt.target.result);
console.log(md5Hash.toString())
cb(null, evt.target.result);
}
reader.onerror = function (evt) {
cb(new Error("error reading file"));
}
}
}
...
}
The following code outputs md5 of a file:
Anyway, this md5 differs from the original md5sum:
Wrong file is properly saved on server-side (it contains the same md5 of acquired file).
Do you have any suggestion to solve this?
Thanks in advance,
GP
The text was updated successfully, but these errors were encountered:
Hi,
I am using ng-file library to support upload of files.
I have an issue relating to binary files that is described at the following issue:
DockerSecurityPlayground/DSP#51
In order to troubleshoot, I try to log md5sum of a binary file.
When I upload a binary file, I perform the following operation:
Controller ->
The following code outputs md5 of a file:
Anyway, this md5 differs from the original md5sum:
Wrong file is properly saved on server-side (it contains the same md5 of acquired file).
Do you have any suggestion to solve this?
Thanks in advance,
GP
The text was updated successfully, but these errors were encountered: