double-lv / huploadify Goto Github PK
View Code? Open in Web Editor NEWjQuery文件上传插件,HTML5版uploadify,保持与uploadify一致的API
jQuery文件上传插件,HTML5版uploadify,保持与uploadify一致的API
請問如何使用像uploadify 的upload medhod
上传了文件 怎么接受服务端发过来的json字符串 因为我服务端写判断是否提交成功 状态需要范围客户端
如果上传的是图片,如何在选择图片之后(即图片还没有上传到服务器上),就能够预览图片呢?
var thisFile = files[i];
if(parseInt(formatFileSize(thisFile.size,true))>option.fileSizeLimit){
alert('文件'+thisFile.name+'大小超出限制!');
continue;
}
tips:此处alert只执行一次
var thisFile = files[i];
if(parseInt(formatFileSize(thisFile.size,true))>option.fileSizeLimit){
alert('文件'+thisFile.name+'大小超出限制!');
continue;
}
tips:此处alert只执行一次
update:
1.问题来源:第二次上传同一文件时,type file 的onchange事件不执行。
2.我的解决方案:
当提示错误后清空对应的隐藏域的值,让type file的onchange可以执行:
if(parseInt(formatFileSize(thisFile.size,true))>option.fileSizeLimit){
alert('文件'+thisFile.name+'大小超出限制!');
//update:提示错误后清空该隐藏域的值
_this.find('.selectbtn').val("");
continue;
}
文件jquery.Huploadify.js在245、246行含有两个错误:
eleProgress.nextAll('.progressnum.uploadedsize').text(formatFileSize(loaded)); eleProgress.nextAll('.progressnum .totalsize').text(formatFileSize(total));
这样写是找不到uploadedsize和totalsize元素的,要写成
eleProgress.nextAll('.progressnum').find('.uploadedsize').text(formatFileSize(loaded)); eleProgress.nextAll('.progressnum').find('.totalsize').text(formatFileSize(total));
这样才对。
ppt和视频都不能上传
onProgress : function(fileblob, originalfile, loaded, total)
{
var oldSize = parseFloat(oldProgressNum.text()) || 0;
}
当进度条显示的是456kb时候,parseFloat(oldProgressNum.text()) 将获得456.然而事实是想要获得的是mb
也就是本应该显示为456kb,被显示成456MB
你好,
有一处用法不明白,如何才能动态传参呢?
uplodify是通过setting方法实现的,咱们这个该怎么做呢
onUploadStart:function(){ console.log('开始上传'); var obj = { 'sample_type': document.getElementById('sample_type').value, 'sample_level': document.getElementById('sample_level').value, 'user': "{{ app.user.username }}" }; console.log(obj); // $("#file_upload_2").Huploadify("settings", "formData", obj); },
你这个文件特别大的话,比如我上传了50%,点击删除,文件会继续上传直到上传完成
/将输入的文件类型字符串转化为数组,原格式为*.jpg;*.png
getFileTypes : function(str){
var result = [];
var arr1 = str.split(";");
for(var i=0, len=arr1.length; i<len; i++){
result.push(arr1[i]);
}
return result;
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.