Foros del Web » Programando para Internet » Javascript »

Hola alguien puede ayudarme?

Estas en el tema de Hola alguien puede ayudarme? en el foro de Javascript en Foros del Web. alguno de ustedes a utilizado jquery.jqUploader?? necesito ayuda para saber como pasar un parametro desde una ventana x hacia el script jquery.jqUploader este es el ...
  #1 (permalink)  
Antiguo 04/09/2009, 12:46
 
Fecha de Ingreso: mayo-2006
Mensajes: 2
Antigüedad: 17 años, 11 meses
Puntos: 0
Hola alguien puede ayudarme?

alguno de ustedes a utilizado jquery.jqUploader??
necesito ayuda para saber como pasar un parametro desde una ventana x hacia el script jquery.jqUploader

este es el script

Código Script que recibe las variables:
Ver original
  1. jQuery.fn.jqUploader = function(options) {
  2.     return this.each(function(index) {
  3.         var $this = jQuery(this);
  4.         // fetch label value if any, otherwise set a default one
  5.         var $thisForm =  $this.parents("form");
  6.         var $thisInput = $("input[@type='file']",$this);
  7.         var $thisLabel = $("label",$this);
  8.         var containerId = $this.attr("id") || 'jqUploader-'+index;
  9.         var startMessage = ($thisLabel.text() =='') ? 'Please select a file' : $thisLabel.text();
  10.         // get form action attribute value as upload script, appending to it a variable telling the script that this is an upload only functionality
  11.         var actionURL = $thisForm.attr("action");
  12.         // adds a var setting jqUploader to 1, so you can use it for serverside processing
  13.         var prepender = (actionURL.lastIndexOf("?") != -1) ? "&": "?";
  14.         actionURL = actionURL+prepender+'jqUploader=1';
  15.         // check if max file size is set in html form
  16.         var maxFileSize = $("input[@name='MAX_FILE_SIZE']", $(this.form)).val();
  17.         var opts = jQuery.extend({
  18.                 width:320,
  19.                 height:85,
  20.                 version: 8, // version 8+ of flash player required to run jqUploader
  21.                 background: 'FFFFFF', // background color of flash file
  22.                 src:    'jqUploader.swf',
  23.                 uploadScript:     actionURL,
  24.                 afterScript:      null, // if this is empty, jqUploader will replace the upload swf by a hidden input element
  25.                 //varName:          $thisInput.attr("name"),  //this holds the variable name of the file input field in your html form
  26.                 allowedExt:       '*.jpg; *.jpeg; *.png', // allowed extensions
  27.                 allowedExtDescr:  'Images (*.jpg; *.jpeg; *.png)',
  28.                 params:           {menu:false},
  29.                 flashvars:        {},
  30.                 hideSubmit:       true,
  31.                 barColor:             '0000CC',
  32.                 maxFileSize:      maxFileSize,
  33.                 startMessage:     startMessage,
  34.                 errorSizeMessage: 'File is too big!',
  35.                 validFileMessage: 'now click Upload to proceed',
  36.                 progressMessage: 'Please wait, uploading ',
  37.                 endMessage:    'You\'re all done'
  38.         }, options || {}
  39.         );
  40.         // disable form submit button
  41.         if (opts.hideSubmit==true) {
  42.             $("*[@type='submit']",this.form).hide();
  43.         }
  44.         // THIS WILL BE EXECUTED IN THE USECASE THAT THERE IS NO REDIRECTION TO BE DONE AFTER UPLOAD
  45.         TerminateJQUploader = function(containerId,filename,varname){
  46.             $this= $('#'+containerId).empty();
  47.             $this.text('').append('<span style="color:#00CC00">Upload of <strong>'+filename+'</strong> finished! (the filename is now stored in the form as an hidden input field)</span><input name="'+varname+'" type="hidden" id="'+varname+'" value="'+filename+'"/>');
  48.             var myForm = $this.parents("form");
  49.             myForm.submit(function(){return true});
  50.             $("*[@type='submit']",myForm).show();
  51.         }
  52.         var myParams = '';
  53.         for (var p in opts.params){
  54.                 myParams += p+'='+opts.params[p]+',';
  55.         }
  56.         myParams = myParams.substring(0, myParams.length-1);
  57.         // this function interfaces with the jquery flash plugin
  58.         jQuery(this).flash(
  59.         {
  60.             src: opts.src,
  61.             width: opts.width,
  62.             height: opts.height,
  63.             id:'movie_player-'+index,
  64.             bgcolor:'#'+opts.background,
  65.             flashvars: {
  66.                 containerId: containerId,
  67.                 uploadScript: opts.uploadScript,
  68.                 afterScript: opts.afterScript,
  69.                 allowedExt: opts.allowedExt,
  70.                 allowedExtDescr: opts.allowedExtDescr,
  71.                 varName :  opts.varName,
  72.                 barColor : opts.barColor,
  73.                 maxFileSize :opts.maxFileSize,
  74.                 startMessage : opts.startMessage,
  75.                 errorSizeMessage : opts.errorSizeMessage,
  76.                 validFileMessage : opts.validFileMessage,
  77.                 progressMessage : opts.progressMessage,
  78.                 endMessage: opts.endMessage
  79.             },
  80.             params: myParams
  81.         },
  82.         {
  83.             version: opts.version,
  84.             update: false
  85.         },
  86.             function(htmlOptions){
  87.                 var $el = $('<div id="'+containerId+'" class="flash-replaced"><div class="alt">'+this.innerHTML+'</div></div>');
  88.                      $el.prepend($.fn.flash.transform(htmlOptions));
  89.                      $('div.alt',$el).remove();
  90.                      $(this).after($el).remove();
  91.             }
  92.         );
  93.     });
  94. };
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:06.