EasyUI Forum

General Category => General Discussion => Topic started by: qianet on June 13, 2017, 01:11:47 PM



Title: Could you add an new plugin to upload file?
Post by: qianet on June 13, 2017, 01:11:47 PM
 ;DCould you add an new plugin to upload file?


Title: Re: Could you add an new plugin to upload file?
Post by: stworthy on June 14, 2017, 02:02:47 AM
The 'filebox' component allows you to update files to remote server. Please look at this example https://www.jeasyui.com/demo/main/index.php?plugin=FileBox&theme=default&dir=ltr&pitem=&sort=


Title: Re: Could you add an new plugin to upload file?
Post by: qianet on June 18, 2017, 07:58:46 AM
Thanks for you replay.
but, I want to get a upload file plugin like "http://www.uploadify.com/".
 :)

an plugin in easyui framework.
my projects only use one framework. :)


Title: Re: Could you add an new plugin to upload file?
Post by: Pierre on June 19, 2017, 01:05:41 AM
Hello
as Stworthy said, you already have upload file plugin.
You have detailed demo how to iplement it (on link Stworthy posted).
It is jEasyUI plugin so you do not need another framework.


Title: Re: Could you add an new plugin to upload file?
Post by: proceno72 on June 20, 2017, 05:37:01 AM
If it can help you, this is how I'm using "upload file" plugin:
Code:
<div style="width: 300px;">
<form enctype="multipart/form-data" id="id-ff" name="id-ff" method="post">
<table border="0" style="width:100%">
<tr>
<td><input id="id-fb" name="userfile[]" type="text" style="width: 100%;"></td>
<td style="width: 90px; text-align: right;"><a id="id-btn-upload" href="javascript:void(0)">Upload</a></td>
</tr>
</table>
</form>
</div>
<div id="multi-purpose"></div>
<script type="text/javascript">
$(function() {
// Show a progress bar on modal window
function progressFile(method,val){
var div_id='win-progress-file';
var progress_id='progress-file';
var contenthtml = '<div id="'+progress_id+'" class="easyui-progressbar" style="width:100%;"></div>' +
'<div style="margin-top: 10px; text-align: center; font-size: 1.3em; font-weight: bold;">Uploading files</div>';
var op = method.toLowerCase();
switch (op) {
case 'show':
$("#multi-purpose").append('<div id="'+div_id+'" style="padding: 20px;"></div>');
$("#"+div_id).window({
title: 'Wait please ...',
width: 300,
resizable: false, shadow: false,
minimizable: false, maximizable: false, collapsible:false, closable: false,
modal: true,
onClose: function (event, ui) {
$("#"+div_id).window('destroy');
$("#"+div_id).remove();
},
content: contenthtml
});
break;
case 'close':
$("#"+div_id).window('close');
break;
case 'update':
$("#"+progress_id).progressbar('setValue', val);
break;

}
}

    // upload function (submit form)
    function upLoad() {
        if ($('#id-fb').textbox('getValue').length === 0) {
            $.messager.alert('Message','No files selected for upload.','error');
            return false;
        }
        $('#id-ff').form('submit', {
            url: 'manage-uploaded-files.php', //What do you want to do with files uploaded on server?
            iframe: false,
            onProgress: function (percent) {
                progressFile('update',percent);
            },
            onSubmit: function(param) {
                progressFile('show');
            },
            success: function(data){
                $('#id-ff').form('clear');
$.messager.alert('Message','Files uploaded.','info');
}
        });
    }

$('#id-fb').filebox({
buttonText: 'Browse...',
multiple: true,
icons:[{
iconCls:'icon-clear',
handler: function(e){
$(e.data.target).filebox('clear');
}
}],
onChange: function (newValue, oldValue) {
if ($(this).textbox('getValue').length > 0 ) {
$('#id-btn-upload').linkbutton('enable');
}
else { $('#id-btn-upload').linkbutton('disable'); }
}
});
$('#id-btn-upload').linkbutton({
iconCls: 'icon-upload', disabled: true, plain: true,
onClick: function() { upLoad(); }
});
$('#id-ff').form();
}
</script>