R
R
Ruslan Leviev2011-03-11 01:10:28
JavaScript
Ruslan Leviev, 2011-03-11 01:10:28

Problems with plupload?

I'm trying to multi-upload files of various formats for a project using the plupload plugin . The problem is that it only works for me with images and only with the obligatory resizing of them.
I even took the files from the example that comes with the plugin archive.

We connect the plugin and libraries:

...<br>
<script type="text/javascript" src="http://www.google.com/jsapi"></script><br>
<script type="text/javascript"><br>
  google.load("jquery", "1.3");<br>
</script><br>
<link rel="stylesheet" href="css/plupload.queue.css" type="text/css" media="screen" /><br>
 <script type="text/javascript" src="../js/gears_init.js"></script><br>
 <script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script><br>
 <script type="text/javascript" src="../js/plupload.full.min.js"></script><br>
 <script type="text/javascript" src="../src/javascript/jquery.plupload.queue.js"></script><br>
...<br>


Initialize the plugin and set the settings:

$(function() {<br>
  var uploader = new plupload.Uploader({<br>
    runtimes : 'gears,browserplus,html5,html4',<br>
    browse_button : 'pickfiles',<br>
    max_file_size : '10mb',<br>
    url : 'upload.php',<br>
    resize : {width : 320, height : 240, quality : 90},<br>
    filters : [<br>
      {title : "Image files", extensions : "jpg,gif,png"},<br>
      {title : "Zip files", extensions : "zip"}<br>
    ]<br>
  });<br>


Create the necessary containers:

<form id="submit-form" method="post" action="dump.php"><br>
  <h1>Custom example</h1><br>
<br>
  <p>Shows you how to use the core plupload API.</p><br>
<br>
  <div><br>
    <div id="filelist">No runtime found.</div><br>
    <br /><br>
    <a id="pickfiles" href="#">[Select files]</a> <br>
    <a id="uploadfiles" href="#">[Upload files]</a><br>
  </div><br>
    <br>
    <input type="submit" /><br>
</form><br>


The upload.php file remains the same as it comes with the plugin archive, except that the address of the folder where uploaded files are moved to has been changed.

What is the result?
I don't need to resize images at all. What I really need is Ajax multi-upload (and not just images, but a large list of file formats).

With the above code, only loading images works fine for me. Files of any other formats on the progress bar show that they have loaded completely (100%), but in reality no file appears and there is no “successful response” from the download script.
Firebug shows an error, but the response itself is empty.

b41fb225166e964c950f15e6ca5b4f9a.png

How it works, I don't understand. After all, all variants of upload.phpend with at least some JSON response, and in order for nothing to come in response, it turns out that the script execution time must expire, although the download process lasts only a few seconds (max_execution_time is exactly many times longer).

Manipulations with the option to resize the image
If you remove the option from the settings:

...<br>
  resize : {width : 320, height : 240, quality : 90},<br>
...<br>

either set its value = false , or pass an empty object {} - then even loading images stops working, everything starts to happen in the same way as with all other types of files (described above).

Debugging using the plupload method
Since Firebug did not say anything useful in my case, I introduced debugging into Javascript, an example of which is given by the plupload authors themselves.

The output of debugging information for a successful file upload (return the resize option, load only images) can be viewed here .

Output of debugging information for unsuccessful loading (progress bar showed 100%, but the file did not appear, nothing came in response, the resize option was removed) can be viewed here.

Technical data
If it matters, testing on local Win machine, nginx-0.9.4 server (without Apache), PHP 5.3.5 as CGI, Firefox 3.6.15 browsers and Google Chrome 10.0.648.127 beta.

Archive with all sample files.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
STEVER, 2012-01-11
@STEVER

I think it’s no longer relevant for the author of the topic, but if someone also encounters such an error, I’ll say: I had a problem in a similar situation by increasing the download limit (on the server side).
Those. everything worked well while small resized pictures were loaded, but when I turned off this option, the files really stopped loading.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question