如何写functionToGenerateMD5hash这段代码?我已经有了fileVideo,我需要通过单击按钮将此文件的md5哈希发送到服务器.
$("#someButton").click(function() {
var fr = new FileReader();
fr.onload = function(e) {
string md5 = functionToGenerateMD5hash(e.target.result);
// send md5 here
};
fr.readAsArrayBuffer(fileVideo);
Run Code Online (Sandbox Code Playgroud) 我有HTML代码.我需要一些javascript代码在每次迭代时更新值
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
Run Code Online (Sandbox Code Playgroud)
我尝试做这样的事情:
var progressBar = document.getElementById("progressBar");
progressBar.value += i;
Run Code Online (Sandbox Code Playgroud)
但这不起作用.它在循环完成时更新进度条.
我需要从 FormData 读取数据吗?我尝试阅读类似的内容,someFormatData["valueName"]但它不起作用。
options["fileId"]或options["file"]不起作用。我也尝试options.fileId相同的结果:
function upload(file, fileId, callback) {
var formData = new FormData();
formData.append("file", file);
formData.append("fileID", fileId);
$.ajax({
url: '/url',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
callback(response);
}
});
}
asyncTest("test upload chunk", function() {
var blob = new Blob(["Hello world!"], { type: "text/plain" }),
options = null,
fileID ="someFileID",
response;
jQuery.ajax = function(param) {
options = param; // THIS is FormData object
// how to read …Run Code Online (Sandbox Code Playgroud) 如何设置非像素位置?我试试这个
var stack = { "dir1": "down", "dir2": "right", "firstpos1": 50, "firstpos2": 50 };
Run Code Online (Sandbox Code Playgroud)
但我认为这是不好的,因为屏幕分辨率不同.
javascript ×3
form-data ×1
hash ×1
loops ×1
md5 ×1
node.js ×1
pnotify ×1
position ×1
progress-bar ×1
qunit ×1