Home > php教程 > php手册 > webupload teaches you how to upload large files

webupload teaches you how to upload large files

WBOY
Release: 2016-08-04 08:56:21
Original
1149 people have browsed it

This article shares three different examples of webupload uploading large files: file upload, image upload and html5 drag and drop image upload. This can be applied to mobile phone uploads.
webupload teaches you how to upload large files//Upload pictures<br> // Initialize Web Uploader<br> var uploader = WebUploader.create({<br> <br> // Whether to automatically upload the file after selecting it. <br> auto: true,<br> <br> // swf file path<br> swf: 'js/Uploader.swf',<br> <br> // File receiving server. <br> Server: 'upload.php',<br> <br> //Button to select file. Optional. <br> // Internally created based on the current operation, it may be an input element or flash.<br> Pick: '#imgPicker',<br> <br> // Only allow selection of image files. <br> Accept: {<br>          title: 'Images',<br>          extensions: 'gif,jpg,jpeg,bmp,png',<br>         mimeTypes: 'image/*'<br> }<br> });<br> <br> //When a file is added<br> uploader.on( 'fileQueued', function( file ) {<br> var $list = $("#fileList"),<br>         $li = $(<br> '<div id="' + file.id + '" class="file-item thumbnail">' +<br> ‘<img alt="webupload teaches you how to upload large files" >’ +<br> ‘<div class="info">' + file.name + '</div>' +<br>                 '</div>'<br> ),<br>          $img = $li.find('img');<br> <br> <br> // $list is the container jQuery instance<br> $list.append( $li );<br> <br> //Create thumbnail <br> // If it is a non-image file, you do not need to call this method. <br> // thumbnailWidth x thumbnailHeight is 100 x 100<br> uploader.makeThumb( file, function( error, src ) {<br>            if ( error ) {<br>                 $img.replaceWith('<span>cannot preview</span>');<br>                  return;<br>         }<br> <br>          $img.attr( 'src', src );<br> }, 100, 100 );<br> });webupload real-time drag upload demonstration: http://www.sucaihuo.com/js/901.html

webupload teaches you how to upload large files Powerful file upload plug-in with upload progress-WebUploader.zip ( 188.94 KB Download: 21 times )

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template