Mensajes de error de plupload

I'm using Plupload with a rails app. The uploader allows users to submit images, but I require that the images be greater than a certain minimum pixel size. This is validated on the server side when processing an image received from Plupload.

Now, the uploader is working fine, but when a particular file fails the user sees an orange triangle and if they hover over it they get "HTTP error." That is pretty useless for the average user.

This is what I have in my rails controller right now:

def create
    @photo = => params[:file])
        head :ok
        head :bad_request

How can I pass back the descriptive error messages from my application to Plupload so they can be displayed to the user in that orange triangle?

Do I need to return some json or xml, or something different? I've experimented with returning different representations of the failed image object, but so far nothing I've done has gotten my error messages picked up by Plupload.

¡Agradezco cualquier ayuda!

preguntado el 27 de agosto de 11 a las 21:08

Did you ever find a solution to this? I am receiving the same Http Error when server-side errors occur, except I am using .NET. -

Nope, never found a workaround for it and quit using Plupload. -

1 Respuestas

Multiple upload carrierware plupload

    class Adm::GaleriasImagensController < ApplicationController
    layout "adm_layout"
     def create

      @adm_galerias_imagem =
        respond_to do |format|
              head :ok
            head :bad_request         

<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
<br />

<div id="container">
<a id="pickfiles" href="javascript:;">[Select files]</a> 
<a id="uploadfiles" href="javascript:;">[Upload files]</a>

<%= link_to 'Back', adm_galerias_imagens_path, class: "btn btn-default" %>

<% content_for :js do %>
  var uploader = new plupload.Uploader({
    runtimes : 'html5,flash,silverlight,html4',
    browse_button : 'pickfiles', // you can pass in id...
    container: document.getElementById('container'), // ... or DOM Element itself
    url : '<%= adm_galerias_imagens_path %>',
    multipart: true,
    max_file_size : '10mb',
    multipart_params: {
      "authenticity_token" : "<%= form_authenticity_token %>",
      '<%= Rails.application.config.session_options[:key] %>': '<%= request.session_options[:id] %>',
      "adm_galerias_imagem[galeria_id]": <%= params[:id] %>
    flash_swf_url : '/assets/Moxie.swf',
    silverlight_xap_url : '/assets/Moxie.xap',
    filters : {
      max_file_size : '10mb',
      mime_types: [
      {title : "Image files", extensions : "jpg,gif,png"},
      {title : "Zip files", extensions : "zip"}
uploader.bind('Init', function(up, params) {
  $('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
uploader.bind('FilesAdded', function(up, files) {
  $.each(files, function(i, file) {
      '<div id="' + + '">' +
      'File: ' + + ' (' + plupload.formatSize(file.size) + ') <b></b>' +'</div>'
uploader.bind('UploadProgress', function(up, file) {
  $('#' + + " b").html(file.percent + "%");
$('#uploadfiles').click(function(e) {
<% end %> 


        <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
        <script type="text/javascript">
            <%= yield :js %>

Respondido 28 Jul 14, 05:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.