一次性点击选择文件并上传 - upload-at-click
fmms
13年前
<p>这是一个 JavaScript 库用来实现点击链接、按钮或者某个元素上传文件的功能。</p> <h3>特性:</h3> <ul> <li> <div id="gt-res-content" class="almost_half_cell"> <div style="zoom:1;" dir="ltr"> <span id="result_box" lang="zh-CN" class="short_text"><span>一次性点击</span></span> <span id="result_box" lang="zh-CN" class="short_text"><span>选择</span><span>文件并上传</span></span> </div> </div> </li> <li>没有额外的依赖(如 jQuery...) </li> <li>没有Flash<br /> </li> <li>非常小巧<br /> </li> <li>支持多浏览器<br /> </li> </ul> <p>在线演示:</p> <p><a href="/misc/goto?guid=4959500774795920306" target="_blank">http://upload-at-click.narod.ru/demo.html</a></p> <p>示例代码:</p> <pre class="brush:javascript; toolbar: true; auto-links: false;"> var uploader = document.getElementById('uploader'); upclick( { element: uploader, action: '/path_to/you_server_script.php', onstart: function(filename) { alert('Start upload: '+filename); }, oncomplete: function(response_data) { alert(response_data); } });</pre> <p></p> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326513050343" target="_blank">http://www.open-open.com/lib/view/home/1326513050343</a></p>