1. Trang chủ
  2. » Thể loại khác

Multi upload file form pptx

2 167 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 1,11 MB

Nội dung

Multi upload file form Multi Upload file form. (Chỉ là code trên client) Nhớ Include jquery lastest. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <title>Untitled Page</title> <script "jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ var fileMax = 3; $('#asdf').after('<div id="files_list" style="border:1px solid black;padding:5px;background:#fff;font-size:x-small;"><strong>Files (maximum '+fileMax+'):</strong></div>'); $("input.upload").change(function(){ doIt(this, fileMax); }); }); function doIt(obj, fm) { if($('input.upload').size() > fm) { alert('Max files is '+fm); obj.value=''; return true; } $(obj).hide(); $(obj).parent().prepend('<input type="file" class="upload" name="fileX[]" />').find("input").change(function() {doIt(this, fm)}); var v = obj.value; //File size if (navigator.userAgent.indexOf("Firefox") != -1){ var node = document.getElementById('element_input'); var fileSize = node.files[0].fileSize; }else{ var myFSO = new ActiveXObject("Scripting.FileSystemObject"); var thefile = myFSO.getFile(v); var fileSize = thefile.size; } if(v != '') { $("div#files_list").append('<div>' + v + '&nbsp;&nbsp;&nbsp; <font color=blue>File size : ' + fileSize + 'bytes.</font> &nbsp;&nbsp;&nbsp;<a href="#" class="remove" />remove</a></div>') .find("a").click(function(){ $(this).parent().remove(); $(obj).remove(); return true; }); } }; </script> </head> <body> <h1>Multiple File Upload</h1> <form action="#" method="post" enctype="multipart/form-data" name="asdf" id="asdf" runat="server"> <div id="mUpload"> <input type="file" id="element_input" class="upload" name="fileX[]" /><br /> <input type="button" name="Submit" value="Submit" id="send" /> </div> </form> <script type+"text/javascript"> $('#send').click(function(){ alert('Demonstration Only: file upload disabled'); }); </script> </body> </html> . Multi upload file form Multi Upload file form. (Chỉ là code trên client) Nhớ Include jquery lastest. <!DOCTYPE html. ActiveXObject("Scripting.FileSystemObject"); var thefile = myFSO.getFile(v); var fileSize = thefile.size; } if(v != '') { $("div#files_list").append('<div>'. }; </script> </head> <body> <h1>Multiple File Upload& lt;/h1> < ;form action="#" method="post" enctype="multipart /form- data" name="asdf" id="asdf"

Ngày đăng: 18/06/2014, 18:20

TỪ KHÓA LIÊN QUAN

w