Foros del Web » Programando para Internet » Jquery »

jquery file upload solo sube 2 archivos

Estas en el tema de jquery file upload solo sube 2 archivos en el foro de Jquery en Foros del Web. Hola me descargue el jquery file upload y lo instale para probarlo en mi localost con Xampp y con ese cargador de archivos uno puede ...
  #1 (permalink)  
Antiguo 03/03/2012, 18:15
 
Fecha de Ingreso: septiembre-2011
Mensajes: 480
Antigüedad: 12 años, 8 meses
Puntos: 18
jquery file upload solo sube 2 archivos

Hola me descargue el jquery file upload y lo instale para probarlo en mi localost con Xampp y con ese cargador de archivos uno puede subir cuantas imagenes quira...lo que sucede es que yo selecciono mas de dos imagenes y solo me carga nada mas dos! o sea solo me guarda en el directorio las dos primeras y el resto hace como si las cargo y todo pero en realidad no cargo nada, les muestro el codigo que uso:


Código HTML:
Ver original
  1. <link rel="stylesheet" href="css_1/bootstrap.css">
  2. <!-- Generic page styles -->
  3. <link rel="stylesheet" href="css_1/style.css">
  4. <!-- Bootstrap styles for responsive website layout, supporting different screen sizes -->
  5. <link rel="stylesheet" href="css_1/bootstrap-responsive.css">
  6. <!-- Bootstrap CSS fixes for IE6 -->
  7. <!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-ie6.min.css"><![endif]-->
  8. <!-- Bootstrap Image Gallery styles -->
  9. <link rel="stylesheet" href="css_1/bootstrap-image-gallery.css">
  10. <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
  11. <link rel="stylesheet" href="css_1/jquery.fileupload-ui.css">
  12. <!-- Shim to make HTML5 elements usable in older Internet Explorer versions -->
  13. <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
  14.  
  15.  
  16. <!-- The file upload form used as target for the file upload widget -->
  17.     <form id="fileupload" action="subir_img.php" method="POST" enctype="multipart/form-data">
  18.         <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
  19.         <div class="row fileupload-buttonbar">
  20.             <div class="span7">
  21.                 <!-- The fileinput-button span is used to style the file input field as button -->
  22.                 <span class="btn btn-success fileinput-button">
  23.                     <span><i class="icon-plus icon-white"></i> Add files...</span>
  24.                     <input type="file" name="file[]" multiple>
  25.                    
  26.                 </span>
  27.                 <button type="submit" class="btn btn-primary start">
  28.                     <i class="icon-upload icon-white"></i> Start upload
  29.                 </button>
  30.                 <button type="reset" class="btn btn-warning cancel">
  31.                     <i class="icon-ban-circle icon-white"></i> Cancel upload
  32.                 </button>
  33.                 <button type="button" class="btn btn-danger delete">
  34.                     <i class="icon-trash icon-white"></i> Delete
  35.                 </button>
  36.                 <input type="checkbox" class="toggle">
  37.             </div>
  38.             <div class="span5">
  39.                 <!-- The global progress bar -->
  40.                 <div class="progress progress-success progress-striped active fade">
  41.                     <div class="bar" style="width:0%;"></div>
  42.                 </div>
  43.             </div>
  44.         </div>
  45.         <!-- The loading indicator is shown during image processing -->
  46.         <div class="fileupload-loading"></div>
  47.         <br>
  48.         <!-- The table listing the files available for upload/download -->
  49.         <table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
  50.  
  51.  
  52. <script id="template-upload" type="text/x-tmpl">
  53. {% for (var i=0, file; file=o.files[i]; i++) { %}
  54.     <tr class="template-upload fade">
  55.         <td class="preview"><span class="fade"></span></td>
  56.         <td class="name">{%=file.name%}</td>
  57.         <td class="size">{%=o.formatFileSize(file.size)%}</td>
  58.         {% if (file.error) { %}
  59.             <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
  60.         {% } else if (o.files.valid && !i) { %}
  61.            <td>
  62.                <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
  63.             </td>
  64.             <td class="start">{% if (!o.options.autoUpload) { %}
  65.                 <button class="btn btn-primary">
  66.                     <i class="icon-upload icon-white"></i> {%=locale.fileupload.start%}
  67.                 </button>
  68.             {% } %}</td>
  69.         {% } else { %}
  70.             <td colspan="2"></td>
  71.         {% } %}
  72.         <td class="cancel">{% if (!i) { %}
  73.             <button class="btn btn-warning">
  74.                 <i class="icon-ban-circle icon-white"></i> {%=locale.fileupload.cancel%}
  75.             </button>
  76.         {% } %}</td>
  77.     </tr>
  78. {% } %}
  79. <!-- The template to display files available for download -->
  80.  
  81. <script src="js_1/jquery17.js"></script>
  82. <!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
  83. <script src="js_1/vendor/jquery.ui.widget.js"></script>
  84. <!-- The Templates plugin is included to render the upload/download listings -->
  85. <script src="js_1/tmpl.js"></script>
  86. <!-- The Load Image plugin is included for the preview images and image resizing functionality -->
  87. <script src="js_1/load-image.js"></script>
  88. <!-- The Canvas to Blob plugin is included for image resizing functionality -->
  89. <script src="http://blueimp.github.com/JavaScript-Canvas-to-Blob/canvas-to-blob.min.js"></script>
  90. <!-- Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo -->
  91. <script src="js_1/bootstrap.js"></script>
  92. <script src="js_1/bootstrap-image-gallery.js"></script>
  93. <!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
  94. <script src="js_1/jquery.iframe-transport.js"></script>
  95. <!-- The basic File Upload plugin -->
  96. <script src="js_1/jquery.fileupload.js"></script>
  97. <!-- The File Upload image processing plugin -->
  98. <script src="js_1/jquery.fileupload-ip.js"></script>
  99. <!-- The File Upload user interface plugin -->
  100. <script src="js_1/jquery.fileupload-ui.js"></script>
  101. <!-- The localization script -->
  102. <script src="js_1/locale.js"></script>
  103. <!-- The main application script -->
  104. <script src="js_1/main.js"></script>
  105. <!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->
  106. <!--[if gte IE 8]><script src="js/cors/jquery.xdr-transport.js"></script><![endif]-->

y con esto proceso los datos que me llegan

alomejor le falte uno que otra llave pero es por unas validaciones que hago de por ejemplo if(isset($_SESSION['log'])){


Código PHP:
Ver original
  1. // ---------- MULTIPLE UPLOADS ----------
  2.     if($fi==""){
  3.    
  4.         echo "  Esta vacio";
  5.         exit;
  6.         }
  7.     // as it is multiple uploads, we will parse the $_FILES array to reorganize it into $files
  8.     $files = array();
  9.    
  10.  
  11.     foreach ($fi as $k => $l) {
  12.         foreach ($l as $i => $v) {
  13.             if (!array_key_exists($i, $files))
  14.                 $files[$i] = array();
  15.             $files[$i][$k] = $v;
  16.         }
  17.     }
  18.  
  19.     // now we can loop through $files, and feed each element to the class
  20.     foreach ($files as $file) {
  21.         $ra=microtime(sha1(sha1(md5(rand(9999999999,9999999999)))));
  22.        
  23.         if($file['type']==""){
  24.         echo "Esta vacio";
  25.         exit;
  26.         }
  27. if(($file['type']!="image/png")&&($file['type']!="image/jpeg")&&($file['type']!="image/gif")){
  28. echo "El tipo de archivo no es de los permitidos!";
  29. exit;  
  30. }
  31.  
  32.  
  33.         // then we check if the file has been uploaded properly
  34.         // in its *temporary* location in the server (often, it is /tmp)
  35. $foo = new Upload($file);
  36. if ($foo->uploaded) {
  37.   // save uploaded image with a new name
  38.   $foo->file_new_name_body = $ra;
  39.   $foo->image_resize = true;
  40.   $foo->image_convert = 'jpg';
  41.   $foo->image_x = 700;
  42.   $foo->image_ratio_y = true;
  43.   $foo->Process($dir_dest);
  44.   if ($foo->processed) {
  45.  
  46.   } else {
  47.  
  48.   }
  49.  
  50.   $foo->file_new_name_body = $ra;
  51.   $foo->image_resize = true;
  52.   $foo->image_convert = 'jpg';
  53.   $foo->image_x = 80;
  54.   $foo->image_ratio_y = true;
  55.   $foo->Process($dir_dest3);
  56.   if ($foo->processed) {
  57.  
  58.   } else {
  59.  
  60.   }
  61.   // save uploaded image with a new name,
  62.   // resized to 100px wide
  63.   $foo->file_new_name_body = $ra;
  64.   $foo->image_resize = true;
  65.   $foo->image_convert = 'jpg';
  66.   $foo->image_x = 200;
  67.   $foo->image_ratio_y = true;
  68.   $foo->Process($dir_dest2);
  69.   if ($foo->processed) {
  70.      $query = "INSERT INTO imagenes(id_usuario,id_album,ruta_normal,ruta_thumb) VALUES ('$id_usuario','$id_album','$ra','$ra')";
  71.            mysql_query($query) or die(mysql_error());
  72.            if(mysql_affected_rows()>0){
  73.             echo "Imagen subida satisfactoriamente!";
  74.            }else{
  75.               echo "La imagen no pudo ser subida";  
  76.            }
  77.     $foo->Clean();
  78.   } else {
  79.     echo 'error : ' . $foo->error;
  80.   }
  81. }

eso es todo! no entiendo que sucede porq no sube mas de dos archivos

Etiquetas: Ninguno
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 11:49.