Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/06/2011, 17:36
Avatar de livemusic
livemusic
 
Fecha de Ingreso: abril-2011
Ubicación: Lima - Chorrillos
Mensajes: 150
Antigüedad: 13 años
Puntos: 18
Respuesta: Un poco de luz con Uploadify

jajajaj pase por lo mismo y llegue a desarrollar esto espero y te ayude.


Código Javascript:
Ver original
  1. $(function(){
  2.    
  3. //  $('#files').empty();
  4.    
  5.     $('#file_upload').uploadify({
  6.         'uploader'    : 'js/uploadify/uploadify.swf',
  7.         'script'      : 'js/uploadify/uploadifyiu.php',
  8.         'multi'       : true,
  9.         'auto'        : true,
  10.         'height'      : '32',
  11.         'width'       : '189',
  12.         'sizeLimit'   : '46080',
  13.         'buttonImg'   : 'js/uploadify/img/browse.png',
  14.         'cancelImg'   : 'js/uploadify/img/cancel.png',
  15.         'folder'      : 'img/uploads',
  16.         'fileExt'     : '*.jpg',
  17.         'fileDesc'    : 'Seleccione imagenes (.jpg)',
  18.         'onComplete'  : function(event, queueID, fileObj, response) {
  19.             $.ajax({
  20.                 type: "GET",
  21.                 url: "ajax.php?pag=uploadImage",
  22.                 data: {nameFile:fileObj.name},
  23.                 dataType: "html",
  24.                 success: function(msg){
  25.                     if(parseInt(msg)!=0){
  26.                             $('<li></li>').appendTo('#uploadImg').html('<img src="img/uploads/'+fileObj.name+'" />');
  27.                     }
  28.                 }
  29.             });
  30.         }
  31.     });
  32.    
  33. });


//////////////////////////
//Una ves completado la carga, envio los valores para ser guardados al servidor
onComplete:
--> ajax.php?pag=uploadImage

// Envio el nombre del fichero
--> nameFile:fileObj.name

// Muestro el fichero subido al servidor
--> $('<li></li>').appendTo('#uploadImg').html('<img src="img/uploads/'+fileObj.name+'" />');

-----------------------------------------------------------------------------------------------------------------------
//Codigo PHP

case "uploadImage":
$rutFile = $_REQUEST['nameFile'];
$uploadImage = new UploadImage($rutFile);
$uploadImage->InsertImage();
break;


Espero y te apueda ayudar a los menos a darte una idea,, Saludos SUERTE ¡¡

Última edición por livemusic; 16/06/2011 a las 17:44