IE 8中jquery file upload 上传图片没反应

jquery file upload 组件在chrome中好使 在IE中愣是没反应,前台的请求发送不到后台Controller中

后台SpringMVC 接受请求如下
@RequestMapping(value = "/fileupload", method = RequestMethod.POST)
public @ResponseBody
HBaseFileInfo upload(HttpServletRequest request, HttpServletResponse response) throws IOException {……}
url: url,
autoUpload: true,
dataType: 'json',
acceptFileTypes: /(.|\/)(gif|jpe?g|png)$/,
done: function (e, data) {
$.each(data.files, function (index, file) {
$('#progress .bar').css('width','0%');
progressall: function (e, data) {
var progress = parseInt(data.loaded / * 100, 10);
$('#progress .bar').css(
progress + '%'






Csdn user default icon
jQuery-File-Upload不起作用:PHP jQuery - 缺少正确的依赖项

<div class="post-text" itemprop="text"> <p>Hi I like the look of the <a href="" rel="nofollow">jQuery-File-Upload plugin</a> but it's insane how hard it is to remove the fluff code from the good bits.. it seems intent on forcing stuff down my throat to work.</p> <p>simply put it works when not part of my code but breaks when I implement it outside of itself</p> <p>EG:</p> <ul> <li>the index.html example is RIDDLED with external url references I don' want / can't use in my actual code. When I cut it out and attempt to lean it out it breaks and there is too much to pour through.</li> <li>the documentation starts far too "deep" into the process for an actual develop who knows what he wants - there are no "simple" examples there are "assumptive" examples based on assuming your context.</li> <li>can someone help me with an index.php of my own that tells me how in as simple and light way as possible how to target an actual php file where I put it, what params are sent (for any subsequent db updating I might do) where to nominate the upload dir in the settings, how to do anything "normal" is hidden.. First principles are always best, but they are absent.</li> <li>simply put: I want to replace the normal "file_upload" htmlform scenario with the nice gui version from jQuery-File-Upload but it's too hard by half!</li> </ul> <p><strong>WHERE ARE THE REAL BITS OF CODE!</strong></p> <p>and before I get lectured this is the 3rd or 4th attempt to implement this over about 9 months and I have stopped after ~ 4 hours on each installation. each other time I have backed off and gone with something less pretty but that I can control properly.</p> <pre><code> &lt;!-- Force latest IE rendering engine or ChromeFrame if installed --&gt; &lt;!--[if IE]&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt; &lt;![endif]--&gt; &lt;!-- Generic page styles --&gt; &lt;link rel="stylesheet" href="../common/jQuery-File-Upload_8.7.1/css/style.css"&gt; &lt;!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --&gt; &lt;link rel="stylesheet" href="../common/jQuery-File-Upload_8.7.1/css/jquery.fileupload-ui.css"&gt; &lt;div class="container"&gt; &lt;!-- The file upload form used as target for the file upload widget --&gt; &lt;form id="fileupload" action="//" method="POST" enctype="multipart/form-data"&gt; &lt;!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --&gt; &lt;div class="row fileupload-buttonbar"&gt; &lt;div class="span7"&gt; &lt;!-- The fileinput-button span is used to style the file input field as button --&gt; &lt;span class="btn btn-success fileinput-button"&gt; &lt;i class="icon-plus icon-white"&gt;&lt;/i&gt; &lt;span&gt;Add files...&lt;/span&gt; &lt;input type="file" name="files[]" multiple&gt; &lt;/span&gt; &lt;button type="submit" class="btn btn-primary start"&gt; &lt;i class="icon-upload icon-white"&gt;&lt;/i&gt; &lt;span&gt;Start upload&lt;/span&gt; &lt;/button&gt; &lt;button type="reset" class="btn btn-warning cancel"&gt; &lt;i class="icon-ban-circle icon-white"&gt;&lt;/i&gt; &lt;span&gt;Cancel upload&lt;/span&gt; &lt;/button&gt; &lt;button type="button" class="btn btn-danger delete"&gt; &lt;i class="icon-trash icon-white"&gt;&lt;/i&gt; &lt;span&gt;Delete&lt;/span&gt; &lt;/button&gt; &lt;input type="checkbox" class="toggle"&gt; &lt;!-- The loading indicator is shown during file processing --&gt; &lt;span class="fileupload-loading"&gt;&lt;/span&gt; &lt;/div&gt; &lt;!-- The global progress information --&gt; &lt;div class="span5 fileupload-progress fade"&gt; &lt;!-- The global progress bar --&gt; &lt;div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"&gt; &lt;div class="bar" style="width:0%;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!-- The extended global progress information --&gt; &lt;div class="progress-extended"&gt;&amp;nbsp;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- The table listing the files available for upload/download --&gt; &lt;table role="presentation" class="table table-striped"&gt;&lt;tbody class="files"&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;/form&gt; &lt;br&gt; &lt;/div&gt; &lt;!-- The blueimp Gallery widget --&gt; &lt;div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even"&gt; &lt;div class="slides"&gt;&lt;/div&gt; &lt;h3 class="title"&gt;&lt;/h3&gt; &lt;a class="prev"&gt;‹&lt;/a&gt; &lt;a class="next"&gt;›&lt;/a&gt; &lt;a class="close"&gt;×&lt;/a&gt; &lt;a class="play-pause"&gt;&lt;/a&gt; &lt;ol class="indicator"&gt;&lt;/ol&gt; &lt;/div&gt; &lt;!-- The template to display files available for upload --&gt; &lt;script id="template-upload" type="text/x-tmpl"&gt; {% for (var i=0, file; file=o.files[i]; i++) { %} &lt;tr class="template-upload fade"&gt; &lt;td&gt; &lt;span class="preview"&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;p class="name"&gt;{}&lt;/p&gt; {% if (file.error) { %} &lt;div&gt;&lt;span class="label label-important"&gt;Error&lt;/span&gt; {%=file.error%}&lt;/div&gt; {% } %} &lt;/td&gt; &lt;td&gt; &lt;p class="size"&gt;{%=o.formatFileSize(file.size)%}&lt;/p&gt; {% if (!o.files.error) { %} &lt;div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"&gt;&lt;div class="bar" style="width:0%;"&gt;&lt;/div&gt;&lt;/div&gt; {% } %} &lt;/td&gt; &lt;td&gt; {% if (!o.files.error &amp;&amp; !i &amp;&amp; !o.options.autoUpload) { %} &lt;button class="btn btn-primary start"&gt; &lt;i class="icon-upload icon-white"&gt;&lt;/i&gt; &lt;span&gt;Start&lt;/span&gt; &lt;/button&gt; {% } %} {% if (!i) { %} &lt;button class="btn btn-warning cancel"&gt; &lt;i class="icon-ban-circle icon-white"&gt;&lt;/i&gt; &lt;span&gt;Cancel&lt;/span&gt; &lt;/button&gt; {% } %} &lt;/td&gt; &lt;/tr&gt; {% } %} &lt;/script&gt; &lt;!-- The template to display files available for download --&gt; &lt;script id="template-download" type="text/x-tmpl"&gt; {% for (var i=0, file; file=o.files[i]; i++) { %} &lt;tr class="template-download fade"&gt; &lt;td&gt; &lt;span class="preview"&gt; {% if (file.thumbnailUrl) { %} &lt;a href="{%=file.url%}" title="{}" download="{}" data-gallery&gt;&lt;img src="{%=file.thumbnailUrl%}"&gt;&lt;/a&gt; {% } %} &lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;p class="name"&gt; &lt;a href="{%=file.url%}" title="{}" download="{}" {%=file.thumbnailUrl?'data-gallery':''%}&gt;{}&lt;/a&gt; &lt;/p&gt; {% if (file.error) { %} &lt;div&gt;&lt;span class="label label-important"&gt;Error&lt;/span&gt; {%=file.error%}&lt;/div&gt; {% } %} &lt;/td&gt; &lt;td&gt; &lt;span class="size"&gt;{%=o.formatFileSize(file.size)%}&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}&gt; &lt;i class="icon-trash icon-white"&gt;&lt;/i&gt; &lt;span&gt;Delete&lt;/span&gt; &lt;/button&gt; &lt;input type="checkbox" name="delete" value="1" class="toggle"&gt; &lt;/td&gt; &lt;/tr&gt; {% } %} &lt;/script&gt; &lt;!-- The Iframe Transport is required for browsers without support for XHR file uploads --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.iframe-transport.js"&gt;&lt;/script&gt; &lt;!-- The basic File Upload plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.ui.widget.js"&gt;&lt;/script&gt; &lt;!-- The basic File Upload plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload.js"&gt;&lt;/script&gt; &lt;!-- The File Upload processing plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload-process.js"&gt;&lt;/script&gt; &lt;!-- The File Upload image preview &amp; resize plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload-image.js"&gt;&lt;/script&gt; &lt;!-- The File Upload audio preview plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload-audio.js"&gt;&lt;/script&gt; &lt;!-- The File Upload video preview plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload-video.js"&gt;&lt;/script&gt; &lt;!-- The File Upload validation plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload-validate.js"&gt;&lt;/script&gt; &lt;!-- The File Upload user interface plugin --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/jquery.fileupload-ui.js"&gt;&lt;/script&gt; &lt;!-- The main application script --&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/main.js"&gt;&lt;/script&gt; &lt;!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 --&gt; &lt;!--[if (gte IE 8)&amp;(lt IE 10)]&gt; &lt;script src="../common/jQuery-File-Upload_8.7.1/js/cors/jquery.xdr-transport.js"&gt;&lt;/script&gt; &lt;![endif]--&gt; </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I was looking at the upload script here:</p> <p><a href="" rel="nofollow"></a></p> <p>It is using jquery file upload to upload multiple files at once. I would like to know how to pass the order of the files that were selected to the upload.php script. ie. if you have 1.jpg, 2.jpg, 3.jpg, 4.jpg, and 4 finishes uploading first, can upload.php receive a variable that tells it that it is the 4th image that was selected? Does jquery file upload have a way of adding the order to the form action perhaps?</p> <p>Thanks in advance.</p> </div>

jquery ajax 上传文件 后台取不到file

正在做一个文件上传的程序,在上传之前需要验证文件的大小,不能超过10M,我采用的是jquery ajax的方式提交到后台Action,由后台Action判断文件大小。 首先看jsp页面: <form name="upload" method="post" enctype="multipart/form-data" action="publish/publish_upload.action" > <span> <s:text name="publish.content"/> <input type="file" name="file" id="uploadfile" onchange="checkFileSize()"> <font size="2" id="xx" color="blue" style="margin-left:30px; ">上传的文件不得大于10M</font> 。。。。省略部分.... </form> javascript代码: function checkFileSize() { var uploadfile = jq("#uploadfile"); var returnval = false; if(uploadfile.val()==""){ alert("请选择需要上传的文件"); return false; } var formData = new FormData(); formData.append("userfile",jq("#uploadfile")); var url = "ajax/ajax_checkFileSize.action"; jq.ajax({ type: "POST", url: url, async: false, enctype: 'multipart/form-data', data: formData, cache: false, contentType: false, processData: false, success: function (msg) { if(msg=="0"){ jq("#checkfile").text(""); alert("上传文件"+uploadfile.val()+"大于10M"); returnval = false; }else{ jq("#checkfile").text("文件可以上传"); jq("#checkfile").reset(); returnval = true; } } }); return returnval; } ajax后台判断也很简单: public String checkFileSize() throws IOException{ out = response.getWriter(); String message=""; try { response.setCharacterEncoding("utf-8"); double size = (double)file.length()/1048576; if(size>10){ message = "0"; }else{ message = "1"; } } catch (Exception e) { e.printStackTrace(); message="0"; }finally{ out.write(message); out.flush(); out.close(); } return null; } 但是每次都在double size = (double)file.length()/1048576;这里报空指针异常 请大家帮忙看看!

关于jquery uploadify 界面在ie 8中显示出错的问题

网页上的上传按钮在ie 8 下显示很奇怪,而其他非ie内核的浏览器以及ie11都没有问题,请问一下是哪 里出问题了,是什么原因造成的呢? ![ie8中的显示]( ![其他浏览器正常显示]( ![ie8上的提示信息]( jquery代码 ``` $("#uploadify").uploadify({ 'uploader' : '<%=basePath%>images/uploadify.swf', 'script' : '<%=basePath%>user/fileUpload.action?userName=${}', 'fileDataName' : 'fileDate', 'folder' : '/', 'queueID' : 'fileQueue', 'queueSizeLimit' : 6, 'multi' : true, 'auto' : false, 'sizeLimit' : 1024*1024*10, 'simUploadLimit' : 2, 'buttonImg' : '<%=basePath%>images/attach.png', 'height' : 20, 'width' : 50, 'cancelImg' : 'images/cancel.png', 'wmode' : 'transparent' , ``` ps.安装了flash,非flash的原因

ajaxfileupload插件 在ie9,jquery-1.11.1.min.js,图片不能上传,求大神给解决方案,只要解决方案,

![图片说明]( if(window.ActiveXObject) { if(jQuery.browser.version=="9.0" || jQuery.browser.version=="10.0"){ var io = document.createElement('iframe'); = frameId; = frameId; }else if(jQuery.browser.version=="6.0" || jQuery.browser.version=="7.0" || jQuery.browser.version=="8.0"){ var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); if(typeof uri== 'boolean'){ io.src = 'javascript:false'; } else if(typeof uri== 'string'){ io.src = uri; } } } 加了 jquery.cycle.js已加 最好可以远程


$.ajaxFileUpload({ url:'${ctx}/CorpAttachmentController/upload', secureuri:false, fileElementId: 'file3', dataType: 'json', success: function (data){ var jsonData = eval("(" + data + ")"); if(jsonData.status == "success"){ $("#logo").val(jsonData.path); saveFile2(); }else{ $("#uploadMark").html("<a href=\"javascript:upload2()\" class=\"pull-right\"> 上传附件</a>"); $("#messageAlert").html("上传失败!"); $("#alertMessaage").modal("show"); } } }); 在ie9中根本不执行,在ajaxFileUpload.js中已经加入了浏览器类型处理 if(window.ActiveXObject) { if(jQuery.browser.version=="9.0") { io = document.createElement('iframe'); = frameId; = frameId; } else if(jQuery.browser.version=="6.0"||jQuery.browser.version=="7.0"||jQuery.browser.version=="8.0") { var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); if(typeof uri== 'boolean'){ io.src = 'javascript:false'; } else if(typeof uri== 'string'){ io.src = uri; } } } 已改 ie9js调试没有错误,只是跳过执行

使用jquery.uploadify上传文件时在IE下抛出: 在String上找不到Name

使用jquery.uploadify2.1.4多次上传同一个文件时,在IE11下抛出入下图所示错误,不知各位前辈是否有遇到类似问题,如何解决的呢?望指教,非常感谢~ ![图片说明](

在IE8 / 9中使用blueimp文件上传插件的jQuery $ _FILES数组为空

<div class="post-text" itemprop="text"> <p>There's lots of questions on StackOverflow related to the Blueimp file upload plugin in IE8/9, but I can't find anything directly related to my problem.</p> <p>I'm using IE10 in the IE8/9 simulator mode. Every time the PHP $_FILES array is empty. I'm including <code>jquery.iframe-transport.js</code> and it loads fine. There are no JavaScript errors. The $_FILES array is just empty.</p> <p>I've tried commenting out the <code>dataType: 'json',</code> line which was recommended in another semi-related question, but that did not help.</p> <p>Not sure what to do here and can't find anything that relates to this. Any help is appreciated.</p> <p>Here's the JavaScript:</p> <pre><code>$('#photo-file').fileupload( { url: 'photos/upload', dataType: 'json', autoUpload: true, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, maxFileSize: 8000000 // 8 MB } ) .on( 'fileuploadadd', function (e, data) { console.log('fileuploadadd'); if (total_photos_queue &lt; available_photos) total_photos_queue++; else return false; } ) .on( 'fileuploadsubmit', function (e, data) { console.log('fileuploadsubmit'); progress_bar.width('0%'); progress_bar.fadeIn(); } ) .on( 'fileuploadprogressall', function (e, data) { console.log('fileuploadprogressall'); var progress = parseInt(data.loaded / * 100, 10); progress_bar.css('width', progress + '%'); } ) .on( 'fileuploaddone', function (e, data) { console.log('fileuploaddone'); $.each( data.result.files, function (index, file) { if (file.filename) photo_uploaded(, file.filename, file.subdir); else if (file.error) console.log('error: ' + file.error); } ); } ) .on( 'fileuploadstop', function (e) { console.log('fileuploadstop'); progress_bar.fadeOut(); } ) .prop('disabled', !$.support.fileInput) .parent().addClass($.support.fileInput ? undefined : 'disabled'); </code></pre> <p>The PHP is simply (for debugging):</p> <pre><code>var_dump($_FILES); die(); </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I have a jQuery script that posts a file to an ASP page using Ajax.</p> <p>It works fine with Chrome, but I am experiencing problems with IE9.</p> <p>Because IE9 wasn't reading the FormData() function, I added the if statement:</p> <pre><code>if(typeof FormData == "undefined"){ </code></pre> <p>But now I am getting this error in the console:</p> <pre><code>SCRIPT5007: Unable to get value of the property 'length': object is null or undefined </code></pre> <p>Here is the full code:</p> <pre><code> &lt;INPUT type="file" name="file" id="file"&gt; &lt;a id="upload_file" class="button"&gt; Upload File &lt;/a&gt; &lt;script&gt; $("a#upload_file").click(function(){ if(typeof FormData == "undefined"){ var data = []; jQuery.each(jQuery('#file')[0].files, function(i, file) { data.push('file-'+i, file); }); } else { var data = new FormData(); jQuery.each(jQuery('#file')[0].files, function(i, file) { data.append('file-'+i, file); }); } jQuery.ajax({ url: 'file_save.asp', data: data, cache: false, contentType: false, processData: false, type: 'POST', success: function(data){ $("#upload_success").text("Your file has uploaded successfully."); $("#file_location").val("files/" + data); $(".filename").html(""); } }); }); &lt;/script&gt; </code></pre> </div>


<div class="post-text" itemprop="text"> <p>So you can understand my English is not very good, but to tell you I'm sorry for this situation to work</p> <p>I am using the version of jQuery 5,11,2</p> <p>servere, but I can not delete the file uploading</p> <p>chrome network in the application / json should write text / html writes</p> <p>I believe that you'll going help you add files Thank you in advance.</p> <p>index.php</p> <pre><code>&lt;?php session_start(); include '../../mysqlayar.php'; include '../../incl/functions.php'; error_reporting(1); require('upload.class.php'); $upload_handler = new UploadHandler(); header('Pragma: no-cache'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Content-Disposition: inline; filename="files.json"'); header('X-Content-Type-Options: nosniff'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE'); header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size'); switch ($_SERVER['REQUEST_METHOD']) { case 'OPTIONS': break; case 'HEAD': case 'GET': $upload_handler-&gt;get(); break; case 'POST': if (isset($_REQUEST['_method']) &amp;&amp; $_REQUEST['_method'] === 'DELETE') { $upload_handler-&gt;delete(); } else { $upload_handler-&gt;post(); } break; case 'DELETE': $upload_handler-&gt;delete(); break; default: header('HTTP/1.1 405 Method Not Allowed'); } </code></pre> <p>resim.php</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""&gt; &lt;html xmlns=""&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;meta name="viewport" content="width=device-width"&gt; &lt;link rel="stylesheet" href=""&gt; &lt;link rel="stylesheet" href=""&gt; &lt;!--[if lt IE 7]&gt;&lt;link rel="stylesheet" href=""&gt;&lt;![endif]--&gt; &lt;link rel="stylesheet" href=""&gt; &lt;link rel="stylesheet" href="css/jquery.fileupload-ui.css"&gt; &lt;!--[if lt IE 9]&gt;&lt;script src=""&gt;&lt;/script&gt;&lt;![endif]--&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="fileupload" action="server/php/index.php" method="POST" enctype="multipart/form-data"&gt; &lt;!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --&gt; &lt;div class="row fileupload-buttonbar"&gt; &lt;div class="span7"&gt; &lt;!-- The fileinput-button span is used to style the file input field as button --&gt; &lt;span class="btn btn-success fileinput-button"&gt; &lt;i class="icon-plus icon-white"&gt;&lt;/i&gt; &lt;span&gt;Resim Ekle...&lt;/span&gt; &lt;input type="file" name="files[]" multiple&gt; &lt;/span&gt; &lt;button type="submit" class="btn btn-primary start"&gt; &lt;i class="icon-upload icon-white"&gt;&lt;/i&gt; &lt;span&gt;Yükle&lt;/span&gt; &lt;/button&gt; &lt;button type="reset" class="btn btn-warning cancel"&gt; &lt;i class="icon-ban-circle icon-white"&gt;&lt;/i&gt; &lt;span&gt;İptal Et&lt;/span&gt; &lt;/button&gt; &lt;button type="button" class="btn btn-danger delete"&gt; &lt;i class="icon-trash icon-white"&gt;&lt;/i&gt; &lt;span&gt;Sil&lt;/span&gt; &lt;/button&gt; &lt;input type="checkbox" class="toggle"&gt; &lt;/div&gt; &lt;!-- The global progress information --&gt; &lt;div class="span5 fileupload-progress fade"&gt; &lt;!-- The global progress bar --&gt; &lt;div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"&gt; &lt;div class="bar" style="width:0%;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!-- The extended global progress information --&gt; &lt;div class="progress-extended"&gt;&amp;nbsp;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- The loading indicator is shown during file processing --&gt; &lt;div class="fileupload-loading"&gt;&lt;/div&gt; &lt;br&gt; &lt;!-- The table listing the files available for upload/download --&gt; &lt;table role="presentation" class="table table-striped"&gt;&lt;tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;/form&gt; &lt;script id="template-upload" type="text/x-tmpl"&gt; {% for (var i=0, file; file=o.files[i]; i++) { %} &lt;tr class="template-upload fade"&gt; &lt;td class="preview"&gt;&lt;span class="fade"&gt;&lt;/span&gt;&lt;/td&gt; &lt;td class="name"&gt;&lt;span&gt;{}&lt;/span&gt;&lt;/td&gt; &lt;td class="size"&gt;&lt;span&gt;{%=o.formatFileSize(file.size)%}&lt;/span&gt;&lt;/td&gt; {% if (file.error) { %} &lt;td class="error" colspan="2"&gt;&lt;span class="label label-important"&gt;{%=locale.fileupload.error%}&lt;/span&gt; {%=locale.fileupload.errors[file.error] || file.error%}&lt;/td&gt; {% } else if (o.files.valid &amp;&amp; !i) { %} &lt;td&gt; &lt;div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"&gt;&lt;div class="bar" style="width:0%;"&gt;&lt;/div&gt;&lt;/div&gt; &lt;/td&gt; &lt;td class="start"&gt;{% if (!o.options.autoUpload) { %} &lt;button class="btn btn-primary"&gt; &lt;i class="icon-upload icon-white"&gt;&lt;/i&gt; &lt;span&gt;{%=locale.fileupload.start%}&lt;/span&gt; &lt;/button&gt; {% } %}&lt;/td&gt; {% } else { %} &lt;td colspan="2"&gt;&lt;/td&gt; {% } %} &lt;td class="cancel"&gt;{% if (!i) { %} &lt;button class="btn btn-warning"&gt; &lt;i class="icon-ban-circle icon-white"&gt;&lt;/i&gt; &lt;span&gt;{%=locale.fileupload.cancel%}&lt;/span&gt; &lt;/button&gt; {% } %}&lt;/td&gt; &lt;/tr&gt; {% } %} &lt;/script&gt; &lt;!-- The template to display files available for download --&gt; &lt;script id="template-download" type="text/x-tmpl"&gt; {% for (var i=0, file; file=o.files[i]; i++) { %} &lt;tr class="template-download fade"&gt; {% if (file.error) { %} &lt;td&gt;&lt;/td&gt; &lt;td class="name"&gt;&lt;span&gt;{}&lt;/span&gt;&lt;/td&gt; &lt;td class="size"&gt;&lt;span&gt;{%=o.formatFileSize(file.size)%}&lt;/span&gt;&lt;/td&gt; &lt;td class="error" colspan="2"&gt;&lt;span class="label label-important"&gt;{%=locale.fileupload.error%}&lt;/span&gt; {%=locale.fileupload.errors[file.error] || file.error%}&lt;/td&gt; {% } else { %} &lt;td class="preview"&gt;{% if (file.thumbnail_url) { %} &lt;a href="#" title="{}" rel="gallery" download="{}"&gt;&lt;img src="{%=file.thumbnail_url%}"&gt;&lt;/a&gt; {% } %}&lt;/td&gt; &lt;td class="name"&gt; &lt;a href="#" title="{}" rel="{%=file.thumbnail_url&amp;&amp;'gallery'%}" download="{}"&gt;{}&lt;/a&gt; &lt;/td&gt; &lt;td class="size"&gt;&lt;span&gt;{%=o.formatFileSize(file.size)%}&lt;/span&gt;&lt;/td&gt; &lt;td colspan="2"&gt;&lt;/td&gt; {% } %} &lt;td class="delete"&gt; &lt;button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"&gt; &lt;i class="icon-trash icon-white"&gt;&lt;/i&gt; &lt;span&gt;{%=locale.fileupload.destroy%}&lt;/span&gt; &lt;/button&gt; &lt;input type="checkbox" name="delete" value="1"&gt; &lt;/td&gt; &lt;/tr&gt; {% } %} &lt;/script&gt; &lt;script src="//"&gt;&lt;/script&gt; &lt;script src="scripts/vendor/jquery.ui.widget.js"&gt;&lt;/script&gt; &lt;script src=""&gt;&lt;/script&gt; &lt;script src=""&gt;&lt;/script&gt; &lt;script src=""&gt;&lt;/script&gt; &lt;script src=""&gt;&lt;/script&gt; &lt;script src=""&gt;&lt;/script&gt; &lt;script src="scripts/jquery.iframe-transport.js"&gt;&lt;/script&gt; &lt;script src="scripts/jquery.fileupload.js"&gt;&lt;/script&gt; &lt;script src="scripts/jquery.fileupload-fp.js"&gt;&lt;/script&gt; &lt;script src="scripts/jquery.fileupload-ui.js"&gt;&lt;/script&gt; &lt;script src="scripts/locale.js"&gt;&lt;/script&gt; &lt;script src="scripts/main.js"&gt;&lt;/script&gt; &lt;!--[if gte IE 8]&gt;&lt;script src="scripts/cors/jquery.xdr-transport.js"&gt;&lt;/script&gt;&lt;![endif]--&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>upload.class.php</p> <pre><code>&lt;?php error_reporting(1); class UploadHandler { protected $options; function __construct($options=null) { $this-&gt;options = array( 'script_url' =&gt; $this-&gt;getFullUrl().'/', 'upload_dir' =&gt; dirname($_SERVER['SCRIPT_FILENAME']).'/files/'.$_SESSION['ilanId']."/", 'upload_url' =&gt; $this-&gt;getFullUrl().'/files/'.$_SESSION['ilanId']."/", 'param_name' =&gt; 'files', // Set the following option to 'POST', if your server does not support // DELETE requests. This is a parameter sent to the client: 'delete_type' =&gt; 'DELETE', // The php.ini settings upload_max_filesize and post_max_size // take precedence over the following max_file_size setting: 'max_file_size' =&gt; null, 'min_file_size' =&gt; 1, 'accept_file_types' =&gt; '/.+$/i', // The maximum number of files for the upload directory: 'max_number_of_files' =&gt; null, // Image resolution restrictions: 'max_width' =&gt; null, 'max_height' =&gt; null, 'min_width' =&gt; 1, 'min_height' =&gt; 1, // Set the following option to false to enable resumable uploads: 'discard_aborted_uploads' =&gt; true, // Set to true to rotate images based on EXIF meta data, if available: 'orient_image' =&gt; false, 'image_versions' =&gt; array( // Uncomment the following version to restrict the size of // uploaded images. You can also add additional versions with // their own upload directories: /* 'large' =&gt; array( 'upload_dir' =&gt; dirname($_SERVER['SCRIPT_FILENAME']).'/files/', 'upload_url' =&gt; $this-&gt;getFullUrl().'/files/', 'max_width' =&gt; 1920, 'max_height' =&gt; 1200, 'jpeg_quality' =&gt; 95 ), */ 'thumbnail' =&gt; array( 'upload_dir' =&gt; dirname($_SERVER['SCRIPT_FILENAME']).'/thumbnails/'.$_SESSION['ilanId']."/", 'upload_url' =&gt; $this-&gt;getFullUrl().'/thumbnails/'.$_SESSION['ilanId']."/", 'max_width' =&gt; 114, 'max_height' =&gt; 114 ) ) ); if ($options) { $this-&gt;options = array_replace_recursive($this-&gt;options, $options); } } protected function getFullUrl() { $https = !empty($_SERVER['HTTPS']) &amp;&amp; $_SERVER['HTTPS'] !== 'off'; return ($https ? 'https://' : 'http://'). (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : ''). (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME']. ($https &amp;&amp; $_SERVER['SERVER_PORT'] === 443 || $_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))). substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')); } protected function set_file_delete_url($file) { $file-&gt;delete_url = $this-&gt;options['script_url'] .'?file='.rawurlencode($file-&gt;name); $file-&gt;delete_type = $this-&gt;options['delete_type']; if ($file-&gt;delete_type !== 'DELETE') { $file-&gt;delete_url .= '&amp;_method=DELETE'; } } protected function get_file_object($file_name) { $file_path = $this-&gt;options['upload_dir'].$file_name; if (is_file($file_path) &amp;&amp; $file_name[0] !== '.') { $file = new stdClass(); $file-&gt;name = $file_name; $file-&gt;size = filesize($file_path); $file-&gt;url = $this-&gt;options['upload_url'].rawurlencode($file-&gt;name); foreach($this-&gt;options['image_versions'] as $version =&gt; $options) { if (is_file($options['upload_dir'].$file_name)) { $file-&gt;{$version.'_url'} = $options['upload_url'] .rawurlencode($file-&gt;name); } } $this-&gt;set_file_delete_url($file); return $file; } return null; } protected function get_file_objects() { return array_values(array_filter(array_map( array($this, 'get_file_object'), scandir($this-&gt;options['upload_dir']) ))); } protected function create_scaled_image($file_name, $options) { $file_path = $this-&gt;options['upload_dir'].$file_name; $new_file_path = $options['upload_dir'].$file_name; list($img_width, $img_height) = @getimagesize($file_path); if (!$img_width || !$img_height) { return false; } $scale = min( $options['max_width'] / $img_width, $options['max_height'] / $img_height ); if ($scale &gt;= 1) { if ($file_path !== $new_file_path) { return copy($file_path, $new_file_path); } return true; } $new_width = $img_width * $scale; $new_height = $img_height * $scale; $new_img = @imagecreatetruecolor($new_width, $new_height); switch (strtolower(substr(strrchr($file_name, '.'), 1))) { case 'jpg': case 'jpeg': $src_img = @imagecreatefromjpeg($file_path); $write_image = 'imagejpeg'; $image_quality = isset($options['jpeg_quality']) ? $options['jpeg_quality'] : 100; break; case 'gif': @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0)); $src_img = @imagecreatefromgif($file_path); $write_image = 'imagegif'; $image_quality = null; break; case 'png': @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0)); @imagealphablending($new_img, false); @imagesavealpha($new_img, true); $src_img = @imagecreatefrompng($file_path); $write_image = 'imagepng'; $image_quality = isset($options['png_quality']) ? $options['png_quality'] : 100; break; default: $src_img = null; } $success = $src_img &amp;&amp; @imagecopyresampled( $new_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height ) &amp;&amp; $write_image($new_img, $new_file_path, $image_quality); // Free up memory (imagedestroy does not delete files): @imagedestroy($src_img); @imagedestroy($new_img); return $success; } protected function validate($uploaded_file, $file, $error, $index) { if ($error) { $file-&gt;error = $error; return false; } if (!$file-&gt;name) { $file-&gt;error = 'missingFileName'; return false; } if (!preg_match($this-&gt;options['accept_file_types'], $file-&gt;name)) { $file-&gt;error = 'acceptFileTypes'; return false; } if ($uploaded_file &amp;&amp; is_uploaded_file($uploaded_file)) { $file_size = filesize($uploaded_file); } else { $file_size = $_SERVER['CONTENT_LENGTH']; } if ($this-&gt;options['max_file_size'] &amp;&amp; ( $file_size &gt; $this-&gt;options['max_file_size'] || $file-&gt;size &gt; $this-&gt;options['max_file_size']) ) { $file-&gt;error = 'maxFileSize'; return false; } if ($this-&gt;options['min_file_size'] &amp;&amp; $file_size &lt; $this-&gt;options['min_file_size']) { $file-&gt;error = 'minFileSize'; return false; } if (is_int($this-&gt;options['max_number_of_files']) &amp;&amp; ( count($this-&gt;get_file_objects()) &gt;= $this-&gt;options['max_number_of_files']) ) { $file-&gt;error = 'maxNumberOfFiles'; return false; } list($img_width, $img_height) = @getimagesize($uploaded_file); if (is_int($img_width)) { if ($this-&gt;options['max_width'] &amp;&amp; $img_width &gt; $this-&gt;options['max_width'] || $this-&gt;options['max_height'] &amp;&amp; $img_height &gt; $this-&gt;options['max_height']) { $file-&gt;error = 'maxResolution'; return false; } if ($this-&gt;options['min_width'] &amp;&amp; $img_width &lt; $this-&gt;options['min_width'] || $this-&gt;options['min_height'] &amp;&amp; $img_height &lt; $this-&gt;options['min_height']) { $file-&gt;error = 'minResolution'; return false; } } return true; } protected function upcount_name_callback($matches) { $index = isset($matches[1]) ? intval($matches[1]) + 1 : 1; $ext = isset($matches[2]) ? $matches[2] : ''; return ' ('.$index.')'.$ext; } protected function upcount_name($name) { return preg_replace_callback( '/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/', array($this, 'upcount_name_callback'), $name, 1 ); } protected function trim_file_name($name, $type, $index) { // Remove path information and dots around the filename, to prevent uploading // into different directories or replacing hidden system files. // Also remove control characters and spaces (\x00..\x20) around the filename: $t = explode(".",$name); @$name = date('i_s_u_u').".$t[1]"; $file_name = trim(basename(stripslashes($name)), ".\x00..\x20"); // Add missing file extension for known image types: if (strpos($file_name, '.') === false &amp;&amp; preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { $file_name .= '.'.$matches[1]; } if ($this-&gt;options['discard_aborted_uploads']) { while(is_file($this-&gt;options['upload_dir'].$file_name)) { $file_name = $this-&gt;upcount_name($file_name); } } return $file_name; } protected function handle_form_data($file, $index) { // Handle form data, e.g. $_REQUEST['description'][$index] } protected function orient_image($file_path) { $exif = @exif_read_data($file_path); if ($exif === false) { return false; } $orientation = intval(@$exif['Orientation']); if (!in_array($orientation, array(3, 6, 8))) { return false; } $image = @imagecreatefromjpeg($file_path); switch ($orientation) { case 3: $image = @imagerotate($image, 180, 0); break; case 6: $image = @imagerotate($image, 270, 0); break; case 8: $image = @imagerotate($image, 90, 0); break; default: return false; } $success = imagejpeg($image, $file_path); // Free up memory (imagedestroy does not delete files): @imagedestroy($image); return $success; } protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null) { $file = new stdClass(); $file-&gt;name = $this-&gt;trim_file_name($name, $type, $index); $file-&gt;size = intval($size); $file-&gt;type = $type; if ($this-&gt;validate($uploaded_file, $file, $error, $index)) { $this-&gt;handle_form_data($file, $index); $file_path = $this-&gt;options['upload_dir'].$file-&gt;name; $append_file = !$this-&gt;options['discard_aborted_uploads'] &amp;&amp; is_file($file_path) &amp;&amp; $file-&gt;size &gt; filesize($file_path); clearstatcache(); if ($uploaded_file &amp;&amp; is_uploaded_file($uploaded_file)) { // multipart/formdata uploads (POST method uploads) if ($append_file) { file_put_contents( $file_path, fopen($uploaded_file, 'r'), FILE_APPEND ); } else { move_uploaded_file($uploaded_file, $file_path); $resimadi = explode("files/",$file_path); $ilanId = $_SESSION['ilanId']; $resimadi = explode("/",$resimadi[1]); mysql_query("INSERT INTO resimler VALUES (\"\", \"$ilanId\", \"$resimadi[1]\")"); } } else { // Non-multipart uploads (PUT method support) file_put_contents( $file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0 ); } $file_size = filesize($file_path); if ($file_size === $file-&gt;size) { if ($this-&gt;options['orient_image']) { $this-&gt;orient_image($file_path); } $file-&gt;url = $this-&gt;options['upload_url'].rawurlencode($file-&gt;name); foreach($this-&gt;options['image_versions'] as $version =&gt; $options) { if ($this-&gt;create_scaled_image($file-&gt;name, $options)) { if ($this-&gt;options['upload_dir'] !== $options['upload_dir']) { $file-&gt;{$version.'_url'} = $options['upload_url'] .rawurlencode($file-&gt;name); } else { clearstatcache(); $file_size = filesize($file_path); } } } } else if ($this-&gt;options['discard_aborted_uploads']) { unlink($file_path); $file-&gt;error = 'abort'; } $file-&gt;size = $file_size; $this-&gt;set_file_delete_url($file); } return $file; } public function get() { $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; if ($file_name) { $info = $this-&gt;get_file_object($file_name); } else { $info = $this-&gt;get_file_objects(); } header('Content-type: application/json'); echo json_encode($info); } public function post() { if (isset($_REQUEST['_method']) &amp;&amp; $_REQUEST['_method'] === 'DELETE') { return $this-&gt;delete(); } $upload = isset($_FILES[$this-&gt;options['param_name']]) ? $_FILES[$this-&gt;options['param_name']] : null; $info = array(); if ($upload &amp;&amp; is_array($upload['tmp_name'])) { // param_name is an array identifier like "files[]", // $_FILES is a multi-dimensional array: foreach ($upload['tmp_name'] as $index =&gt; $value) { $info[] = $this-&gt;handle_file_upload( $upload['tmp_name'][$index], isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index], isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index], $upload['error'][$index], $index ); } } elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) { // param_name is a single object identifier like "file", // $_FILES is a one-dimensional array: $info[] = $this-&gt;handle_file_upload( isset($upload['tmp_name']) ? $upload['tmp_name'] : null, isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ? $upload['name'] : null), isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ? $upload['size'] : null), isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ? $upload['type'] : null), isset($upload['error']) ? $upload['error'] : null ); } header('Vary: Accept'); $json = json_encode($info); $redirect = isset($_REQUEST['redirect']) ? stripslashes($_REQUEST['redirect']) : null; if ($redirect) { header('Location: '.sprintf($redirect, rawurlencode($json))); return; } if (isset($_SERVER['HTTP_ACCEPT']) &amp;&amp; (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) { header('Content-type: application/json'); } else { header('Content-type: text/plain'); } echo $json; } public function delete() { $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; $file_path = $this-&gt;options['upload_dir'].$file_name; $success = is_file($file_path) &amp;&amp; $file_name[0] !== '.' &amp;&amp; unlink($file_path); if ($success) { foreach($this-&gt;options['image_versions'] as $version =&gt; $options) { $file = $options['upload_dir'].$file_name; if (is_file($file)) { unlink($file); $ilanId = $_SESSION['ilanId']; mysql_query("DELETE FROM resimler WHERE ilanId = '$ilanId' and resimadi = '$file_name'"); } } } header('Content-type: application/json'); echo json_encode($success); } } </code></pre> </div>

通过WordPress中的jquery ajax跨浏览器文件上传器

<div class="post-text" itemprop="text"> <p>i am trying to use jquery.upload v1.0.3 found in: <a href="" rel="nofollow"></a></p> <p>below is the js code:</p> <pre><code>fileChange = function(id,element,pos){ $(id).upload(baseUrl+'/library/includes/plugins/fileupload/inc/upload.php', function(data) { alert(data.filename); }, 'json'); } </code></pre> <p>below is the php code:</p> <pre><code>if (move_uploaded_file($_FILES['file']['tmp_name'], '../../../../../../../uploads/'. $_FILES['file']['name'])) { $data = array('filename' =&gt; $_FILES['file']['name']); } else { $data = array('filename' =&gt; 'Failed to save'); } header('Content-type: text/html'); echo json_encode($data); </code></pre> <p>the above works great on firefox, google, safari and mobile devices. however it breaks if i try to use it on ie. so far i have tested on ie9 and ie10 and i keep getting the error below:</p> <pre><code>unable to get value of the property 'filename': object is null or undefined </code></pre> <p>i am under the impression that this plugin should work on ie6+ but i have no idea, i just need this to work ie8+</p> <p>i been scratching my head for hours so any help is greatly appreciated. </p> <p>just an update, my html has input file as hidden via inline style which actions the fileChange function onchange. i also have another visible button which triggers a click event on the input file.</p> </div>

为IE9 / PHP / jQuery强制高效的小文件上传

<div class="post-text" itemprop="text"> <p>I want to have a small upload limit (e.g. 100 kb for testing, perhaps 6 Mb ultimately). The size of the upload can be checked:</p> <ol> <li><p>before the upload</p></li> <li><p>fail when too much is uploaded</p></li> <li><p>after the upload</p></li> </ol> <p>If the user is trying a 1 Gb file ideally (1) should happen so that the file isn't uploaded at all. If not, (2) should happen so that it doesn't take long before the user knows the file is too big. I'd like to avoid the other possibility (3).</p> <p>In HTML5 but not in IE9 the filesize can be checked before uploading using:</p> <pre><code>this.files[0].size </code></pre> <p><a href="">Get file size before uploading</a></p> <p>In IE9 the following might work if the security settings are adjusted:</p> <pre><code>var objFSO = new ActiveXObject("Scripting.FileSystemObject"); var filePath = $("#" + fileid)[0].value; var objFile = objFSO.getFile(filePath); var fileSize = objFile.size; //size in kb </code></pre> <p>Ideally I'd like to use a method that works with IE9. I've heard about flash files being used. I'd like a method that is separate - not using a big plugin.</p> <p>Here is my code. At the moment it uploads the whole file before it checks if the file size is too big.</p> <pre><code>&lt;?php if (isset($_FILES['myfile'])) { if ($_FILES['myfile']['error'] == UPLOAD_ERR_FORM_SIZE) { // $_FILES['myfile']['size'] is 0 echo 'Error: file is too big!&lt;br&gt;'; } else if ($_FILES['myfile']['size'] &gt; 100000) { echo 'File size is too big!&lt;br&gt;'; } else { echo 'File uploaded ok.&lt;br&gt;'; } } var_dump($_FILES); ?&gt; &lt;form method="post" enctype="multipart/form-data"&gt; &lt;input type="hidden" name="MAX_FILE_SIZE" value="100000" /&gt; &lt;input type="file" name="myfile" /&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p>The small upload limit is just for one form so I don't want to change the global PHP settings file.</p> <p>I'm not sure using MAX_FILE_SIZE is a good idea - the person still has to upload the entire file and the filesize data is lost (I might want to tell people how big their upload was)</p> <p>ini_get('post_max_size') returns 8M and ini_get('upload_max_filesize') returns 32M. If files that are over 8 Mb try to be uploaded the file is still fully uploaded (even 40+ Mb). After larger than 8 Mb files are uploaded var_dump($_FILES) returns an empty array.</p> <p>If the file is bigger than about 600 Mb I get a 413 error... that is (1).</p> <p>So I want to do (1) or (2) in IE9, PHP and jQuery.</p> </div>


<div class="post-text" itemprop="text"> <p>is it possible to upload multiple images with single browse button as in facebook multiple upload functionality on all browsers &gt; IE6, but without using flash.I have integrated <a href="" rel="nofollow">ajax-multiple-file-upload-form-using-jquery </a> but its browse button not working properly.</p> <p>I need to click so many times to open a file selection window when i am trying to upload images to different albums.</p> </div>

js添加的input type="file"控件不能上传

![图片说明]( 上传到服务器之前 检测input的值是空的 控件看上去是有选中文件的,很恼火倒腾了8个小时

plupload IE8\IE9浏览器下不请求flash方法

代码如下: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>demo</title> <script src="js/jquery-1.10.2.min.js"></script> <script src="js/plupload.full.min.js"></script> <style> body{ font-size: 12px;} body,p,div{ padding: 0; margin: 0;} .wraper{ padding: 30px 0;} .btn-wraper{ text-align: center;} .btn-wraper input{ margin: 0 10px;} #file-list{ width: 350px; margin: 20px auto;} #file-list li{ margin-bottom: 10px;} .file-name{ line-height: 30px;} .progress{ height: 4px; font-size: 0; line-height: 4px; background: orange; width: 0;} .tip1{text-align: center; font-size:14px; padding-top:10px;} .tip2{text-align: center; font-size:12px; padding-top:10px; color:#b00} .catalogue{ position: fixed; _position:absolute; _width:200px; left: 0; top: 0; border: 1px solid #ccc;padding: 10px; background: #eee} .catalogue a{ line-height: 30px; color: #0c0} .catalogue li{ padding: 0; margin: 0; list-style: none;} </style> </head> <body> <div class="wraper"> <div class="btn-wraper"> <input type="button" value="选择文件..." id="browse" /> </div> <ul id="file-list"> </ul> </div> <script> var uploader = new plupload.Uploader({ //实例化一个plupload上传对象 browse_button : 'browse', url : 'upload.html', flash_swf_url : 'js/Moxie.swf', silverlight_xap_url : 'js/Moxie.xap', filters: { mime_types : [ //只允许上传图片文件 { title : "图片文件", extensions : "jpg,gif,png" } ] } }); uploader.init(); //初始化 //绑定文件添加进队列事件 uploader.bind('FilesAdded',function(uploader,files){ for(var i = 0, len = files.length; i<len; i++){ var file_name = files[i].name; //文件名 //构造html来更新UI var html = '<li id="file-' + files[i].id +'"><p class="file-name">' + file_name + '</p><p class="progress"></p></li>'; $(html).appendTo('#file-list'); !function(i){ previewImage(files[i],function(imgsrc){ $('#file-'+files[i].id).append('<img src="'+ imgsrc +'" />'); }) }(i); } }); //plupload中为我们提供了mOxie对象 //有关mOxie的介绍和说明请看: //如果你不想了解那么多的话,那就照抄本示例的代码来得到预览的图片吧 function previewImage(file,callback){//file为plupload事件监听函数参数中的file对象,callback为预览图片准备完成的回调函数 if(!file || !/image\//.test(file.type)) return; //确保文件是图片 if(file.type=='image/gif'){//gif使用FileReader进行预览,因为mOxie.Image只支持jpg和png var fr = new mOxie.FileReader(); fr.onload = function(){ callback(fr.result); fr.destroy(); fr = null; } fr.readAsDataURL(file.getSource()); }else{ var preloader = new mOxie.Image(); preloader.onload = function() { preloader.downsize( 300, 300 );//先压缩一下要预览的图片,宽300,高300 var imgsrc = preloader.type=='image/jpeg' ? preloader.getAsDataURL('image/jpeg',80) : preloader.getAsDataURL(); //得到图片src,实质为一个base64编码的数据 callback && callback(imgsrc); //callback传入的参数为预览图片的url preloader.destroy(); preloader = null; }; preloader.load( file.getSource() ); } } </script> </body> </html>


SWF格式视频在火狐和谷歌都能正常播放,在IE8 下不能播放,求教大神解决办法??、js代码如下: ``` <script src="${ct}/businessConsole/javascript/jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script> <script src="${ct}/plugins/jwplayer-6.10/jwplayer.js"></script> <title>视频播放</title> <style type="text/css"> #uploader { width: 800px; margin: 0 auto; } </style> </head> <body> <div id="uploader"> <div id="videoPlayer"></div> </div> <script type="text/javascript"> //直接通过http:// 请求文件 视频播放不出来 可能是jwplayer 判断了视频url后缀不是视频格式(mp4 ) //改成页面加载先ajax请求通过文件代码 获取视频文件 返回视频文件名 $(function(){ $.ajax({ type : 'post', url : '${ct}/download.tool', data :{"wjDm":"${param.wjDm}"}, dataType : 'json', success : function(result) { if(result.isSucces){ var file = '${ct}/upload/'+result.url;//返回视频文件名 jwplayer.key = "7BH6PZgZMlvZhlYfcaKzMMQwzYgEHRqYYiZE0w=="; jwplayer("videoPlayer").setup({ flashplayer:'${ct}/jwplayer-6.10/jwplayer.flash.swf', // file:'${ct}/upload/oceans.mp4', file:file, //file:'', image:'${ct}/upload/videoBg.jpg', width:500, height:350, dock:false, modes:'flash' }); }else{ alert('预览失败'); } } }); }); ```


<div class="post-text" itemprop="text"> <p>A form with one upload link already defined </p> <pre><code>&lt;form name="form1" enctype="multipart/form-data" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" &gt; Files to upload &lt;input name="file[]" type="file" multiple/&gt;&lt;br&gt; &lt;button class="add_more"&gt;Add More Files&lt;/button&gt; &lt;input type="submit" value="Upload File" id="upload"/&gt; &lt;/form&gt; </code></pre> <p>and I can add more links for more files if i wish </p> <pre><code>$(document).ready(function(){ $('.add_more').click(function(e){ e.preventDefault(); $(this).before("&lt;input name='file[]' type='file'/ multiple&gt;&lt;br&gt;"); }); }); </code></pre> <p>but after adding more links and files , when i process the form $_FILES array only contains the first file , from the link defined originally in the html. </p> <p>the var_dump($_FILES) output is after uploading the file is </p> <blockquote> <p>array(1) { ["file"]=&gt; array(5) { ["name"]=&gt; array(1) { [0]=&gt; string(14) "xxxxxCV.doc" } ["type"]=&gt; array(1) { [0]=&gt; string(18) "application/msword" } ["tmp_name"]=&gt; array(1) { [0]=&gt; string(14) "/tmp/phph4u15e" } ["error"]=&gt; array(1) { [0]=&gt; int(0) } ["size"]=&gt; array(1) { [0]=&gt; int(63488) } } } </p> </blockquote> <p>Is there a way to dynamically add file uploads that end up in $_FILES ? </p> <p>If i put multiple file upload lines in the html and dont use the jquery adding a link, $_FILES contains multiple files . </p> <p><code>max_file_uploads = 20</code> (php.ini)</p> <p>there are (to me at least) good reasons why I need to store the files in the database rather than as a link</p> <p>if i create a form with 2,3,4 etc links<br> ie </p> <pre><code>&lt;input name="file[]" type="file" multiple/&gt;&lt;br&gt; &lt;input name="file[]" type="file" multiple/&gt;&lt;br&gt; &lt;input name="file[]" type="file" multiple/&gt;&lt;br&gt; &lt;button class="add_more"&gt;Add More Files&lt;/button&gt; &lt;input type="submit" value="Upload File" id="upload"/&gt; &lt;/form&gt; </code></pre> <p>i can upload the files and they are in $_FILES. If i start with one link and add more with jquery, only the file uploaded from the original HTML ( not those add with jquery) is in $_FILES </p> </div>


<div class="post-text" itemprop="text"> <p>I have a laravel project that uses AJAX to send files to be uploaded to the server. All works just fine for as long as the file is less than 100MB. But large files like 450MB and up are not being saved on the server despite receiving a response that the file has been saved. I am using Apache and my php.ini files have both max_upload_size = 1024MB and max_post_size = 1024MB. Please help, any info that will be of helping in debugging I can provide. Thanks.</p> </div>


<div class="post-text" itemprop="text"> <p>I'm developing a simple script to upload a file through AJAX but after form submission, the variable $_FILES is completely empty, although the file exists within php://input, but with no simple way to extract only the file. Anyone knows the reason and/or solution to this problem?</p> <p>I've checked all the common solutions. enctype="multipart/form-data" rights to temp folder form-tags closing doublequotations and the output of the file-input in JS</p> <p>Nothing has solved my problem. </p> <p><strong>RED</strong> This is NOT jquery, and I haven't found a duplicate in 24h. So please don't mark as duplicate unless you're sure it is one.</p> <p><strong>HTML</strong></p> <pre><code>&lt;form action="upload.php" method="POST" enctype="multipart/form-data" id="testf"&gt; &lt;input type="file" name="file" accept=".jpg"&gt; &lt;input type="submit" value="Skicka"&gt; &lt;/form&gt; </code></pre> <p><strong>JavaScript</strong></p> <pre><code>let data = document.querySelector("#testf"); data.onsubmit = function() { var http = new XMLHttpRequest();"upload.php", data.action); http.onreadystatechange = function () { console.log(http.response); } http.setRequestHeader("Content-type", data.enctype); http.send(new FormData(data)); event.preventDefault(); return false; } </code></pre> <p><strong>PHP</strong></p> <pre><code>&lt;?php var_dump($_FILES); ?&gt; </code></pre> <p>This should print the contents of my file, but </p> <pre><code>array(0) {} </code></pre> <p>is all I get. Request payload is:</p> <pre><code>------WebKitFormBoundaryZVGq8suqFUUSFDtW Content-Disposition: form-data; name="file"; filename="david.jpg" Content-Type: image/jpeg ------WebKitFormBoundaryZVGq8suqFUUSFDtW-- </code></pre> </div>

MySQL 8.0.19安装教程(windows 64位)

话不多说直接开干 目录 1-先去官网下载点击的MySQL的下载​ 2-配置初始化的my.ini文件的文件 3-初始化MySQL 4-安装MySQL服务 + 启动MySQL 服务 5-连接MySQL + 修改密码 先去官网下载点击的MySQL的下载 下载完成后解压 解压完是这个样子 配置初始化的my.ini文件的文件 ...



Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂






【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑




时钟功能 还有闹钟功能,温湿度功能,整点报时功能 你值得拥有

学生成绩管理系统(PHP + MYSQL)

做的是数据库课程设计,使用的php + MySQL,本来是黄金搭配也就没啥说的,推荐使用wamp服务器,里面有详细的使用说明,带有界面的啊!呵呵 不行的话,可以给我留言!

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?



获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:itxy41)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!


原价169,限时立减100元! 系统掌握Python核心语法16点,轻松应对工作中80%以上的Python使用场景! 69元=72讲+源码+社群答疑+讲师社群分享会&nbsp; 【哪些人适合学习这门课程?】 1)大学生,平时只学习了Python理论,并未接触Python实战问题; 2)对Python实用技能掌握薄弱的人,自动化、爬虫、数据分析能让你快速提高工作效率; 3)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; 4)想修炼更好的编程内功,优秀的工程师肯定不能只会一门语言,Python语言功能强大、使用高效、简单易学。 【超实用技能】 从零开始 自动生成工作周报 职场升级 豆瓣电影数据爬取 实用案例 奥运冠军数据分析 自动化办公:通过Python自动化分析Excel数据并自动操作Word文档,最终获得一份基于Excel表格的数据分析报告。 豆瓣电影爬虫:通过Python自动爬取豆瓣电影信息并将电影图片保存到本地。 奥运会数据分析实战 简介:通过Python分析120年间奥运会的数据,从不同角度入手分析,从而得出一些有趣的结论。 【超人气老师】 二两 中国人工智能协会高级会员 生成对抗神经网络研究者 《深入浅出生成对抗网络:原理剖析与TensorFlow实现》一书作者 阿里云大学云学院导师 前大型游戏公司后端工程师 【超丰富实用案例】 0)图片背景去除案例 1)自动生成工作周报案例 2)豆瓣电影数据爬取案例 3)奥运会数据分析案例 4)自动处理邮件案例 5)github信息爬取/更新提醒案例 6)B站百大UP信息爬取与分析案例 7)构建自己的论文网站案例


这门课程基于主流的java8平台,由浅入深的详细讲解了java SE的开发技术,可以使java方向的入门学员,快速扎实的掌握java开发技术!


&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。


本课程从初学者角度出发,提供了C#从入门到成为程序开发高手所需要掌握的各方面知识和技术。 【课程特点】 1 由浅入深,编排合理; 2 视频讲解,精彩详尽; 3 丰富实例,轻松易学; 4 每章总结配有难点解析文档。 15大章节,228课时,1756分钟与你一同进步!






想学好JAVA必须要报两万的培训班吗? Java大神勿入 如果你: 零基础想学JAVA却不知道从何入手 看了一堆书和视频却还是连JAVA的环境都搭建不起来 囊中羞涩面对两万起的JAVA培训班不忍直视 在职没有每天大块的时间专门学习JAVA 那么恭喜你找到组织了,在这里有: 1. 一群志同道合立志学好JAVA的同学一起学习讨论JAVA 2. 灵活机动的学习时间完成特定学习任务+每日编程实战练习 3. 热心助人的助教和讲师及时帮你解决问题,不按时完成作业小心助教老师的家访哦 上一张图看看前辈的感悟: &nbsp; &nbsp; 大家一定迫不及待想知道什么是极简JAVA学习营了吧,下面就来给大家说道说道: 什么是极简JAVA学习营? 1. 针对Java小白或者初级Java学习者; 2. 利用9天时间,每天1个小时时间; 3.通过 每日作业 / 组队PK / 助教答疑 / 实战编程 / 项目答辩 / 社群讨论 / 趣味知识抢答等方式让学员爱上学习编程 , 最终实现能独立开发一个基于控制台的‘库存管理系统’ 的学习模式 极简JAVA学习营是怎么学习的? &nbsp; 如何报名? 只要购买了极简JAVA一:JAVA入门就算报名成功! &nbsp;本期为第四期极简JAVA学习营,我们来看看往期学员的学习状态: 作业看这里~ &nbsp; 助教的作业报告是不是很专业 不交作业打屁屁 助教答疑是不是很用心 &nbsp; 有奖抢答大家玩的很嗨啊 &nbsp; &nbsp; 项目答辩终于开始啦 &nbsp; 优秀者的获奖感言 &nbsp; 这是答辩项目的效果 &nbsp; &nbsp; 这么细致的服务,这么好的氛围,这样的学习效果,需要多少钱呢? 不要1999,不要199,不要99,只要9.9 是的你没听错,只要9.9以上所有就都属于你了 如果你: 1、&nbsp;想学JAVA没有基础 2、&nbsp;想学JAVA没有整块的时间 3、&nbsp;想学JAVA没有足够的预算 还等什么?赶紧报名吧,抓紧抢位,本期只招300人,错过只有等时间待定的下一期了 &nbsp; 报名请加小助手微信:eduxy-1 &nbsp; &nbsp;


董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。


文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...


机器学习实战系列套餐以实战为出发点,帮助同学们快速掌握机器学习领域必备经典算法原理并结合Python工具包进行实战应用。建议学习顺序:1.Python必备工具包:掌握实战工具 2.机器学习算法与实战应用:数学原理与应用方法都是必备技能 3.数据挖掘实战:通过真实数据集进行项目实战。按照下列课程顺序学习即可! 课程风格通俗易懂,用最接地气的方式带领大家轻松进军机器学习!提供所有课程代码,PPT与实战数据,有任何问题欢迎随时与我讨论。


发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...


已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...


深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)


本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。


本文的面试题如下: Redis 持久化机制 缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级等问题 热点数据和冷数据是什么 Memcache与Redis的区别都有哪些? 单线程的redis为什么这么快 redis的数据类型,以及每种数据类型的使用场景,Redis 内部结构 redis的过期策略以及内存淘汰机制【~】 Redis 为什么是单线程的,优点 如何解决redis的并发竞争key问题 Red...



【数据结构与算法综合实验】欢乐连连看(C++ & MFC)案例

这是武汉理工大学计算机学院数据结构与算法综合实验课程的第三次项目:欢乐连连看(C++ & MFC)迭代开发代码。运行环境:VS2017。已经实现功能:开始游戏、消子、判断胜负、提示、重排、计时、帮助。


YOLOv3是一种基于深度学习的端到端实时目标检测方法,以速度快见长。本课程将手把手地教大家使用labelImg标注和使用YOLOv3训练自己的数据集。课程分为三个小项目:足球目标检测(单目标检测)、梅西目标检测(单目标检测)、足球和梅西同时目标检测(两目标检测)。 本课程的YOLOv3使用Darknet,在Ubuntu系统上做项目演示。包括:安装Darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 Darknet是使用C语言实现的轻型开源深度学习框架,依赖少,可移植性好,值得深入探究。 除本课程《YOLOv3目标检测实战:训练自己的数据集》外,本人推出了有关YOLOv3目标检测的系列课程,请持续关注该系列的其它课程视频,包括: 《YOLOv3目标检测实战:交通标志识别》 《YOLOv3目标检测:原理与源码解析》 《YOLOv3目标检测:网络模型改进方法》 敬请关注并选择学习!



相关热词 c# cad插入影像 c#设计思想 c#正则表达式 转换 c#form复制 c#写web c# 柱形图 c# wcf 服务库 c#应用程序管理器 c#数组如何赋值给数组 c#序列化应用目的博客园