Foros del Web » Programando para Internet » Jquery »

Uplodidy pasar Ngaleria a archivo php

Estas en el tema de Uplodidy pasar Ngaleria a archivo php en el foro de Jquery en Foros del Web. Hola como estan, Miren mi problema es el siguiente, Estoy usando uplodify para subir imagenes la cosa es que cuando subo la imagen necesito tambien ...
  #1 (permalink)  
Antiguo 28/01/2013, 16:37
 
Fecha de Ingreso: marzo-2007
Mensajes: 751
Antigüedad: 17 años, 1 mes
Puntos: 4
Uplodidy pasar Ngaleria a archivo php

Hola como estan,

Miren mi problema es el siguiente,

Estoy usando uplodify para subir imagenes la cosa es que cuando subo la imagen necesito tambien pasar el Ngaleria, al php pero por mas que lo intento no hay manera, y parere que no funciona con variables de session, este es el codigo a ver si alguien ve algo raro.

Este es el html:

Código HTML:
Ver original
  1. <title>imagenes galerias</title>
  2. <link href="style.css" rel="stylesheet" type="text/css">
  3. <link href="js_galeria/uploadify.css" type="text/css" rel="stylesheet" />
  4. <script type="text/javascript" src="js_galeria/jquery-1.4.2.min.js"></script>
  5. <script type="text/javascript" src="js_galeria/swfobject.js"></script>
  6. <script type="text/javascript" src="js_galeria/jquery.uploadify.v2.1.4.min.js"></script>
  7.  
  8.  
  9. <script type="text/javascript">
  10. $(document).ready(function() {
  11.   $('#file_upload').uploadify({
  12.         'removeCompleted' : false,     
  13.         'fileDesc'  : 'Tipo de imágenes permitidas (.JPG, .GIF, .PNG)',    
  14.     'fileExt'   : '*.jpg;*.jpeg;*.gif;*.png',  
  15.     'uploader'  : 'js_galeria/subida.swf',
  16.     'script'    : 'upload.php',    
  17.     'cancelImg' : 'js_galeria/cancelar.png',                   
  18.     'folder'    : 'uploads',
  19.     'auto'      : false,
  20.         'multi': true,
  21.         'queueSizeLimit': 10,
  22.         'onQueueFull': function(event, queueSizeLimit) {
  23.             alert("El maximo de archivos permitidos simultaneamente es de" + queueSizeLimit + " una vez subidos podras seguir subiendo");
  24.             return false;
  25.         },
  26.                 'onComplete': function(event, ID, fileObj, response, data) {
  27.             // you can use here jQuery AJAX method to send info at server-side.
  28.             $.post("upload.php",{name: fileObj.name, description: $("#description").val()}, function(info) {
  29.             //$.post("insert.php",{name: fileObj.name, description: $("#file_upload").val()}, function(info) {         
  30.                 alert(info); // alert UPLOADED FILE NAME
  31.             });
  32.   });
  33. });
  34. </head>
  35.  
  36. <?php  
  37. session_start();
  38.  
  39. echo $Ngaleria = $_GET['Ngaleria'];
  40.  
  41. if($_GET['Ngaleria']){
  42.  
  43.                     echo $_SESSION['Ngaleria'] = $Ngaleria;
  44.  
  45. }
  46. ?>
  47.  
  48.  
  49.                     <table border="0" align="left" width="1210px" cellpadding="0" cellspacing="0">
  50.                      
  51.                     <tr>
  52.                     <td colspan="2">
  53.                      
  54.                                          
  55.           <table  border="0" width="100%" align="center"  style="background-color:#ffffff;" cellpadding="1" cellspacing="0">
  56.           <tr>        
  57.              
  58.           <td align="center" width="70px" style="border-right:solid 1px #e8e8e8;">
  59.           <font style=" font-family: arial; color:#000000; font-weight:bold; font-size: 13px;">Ver</font>
  60.           </td>
  61.              
  62.              
  63.           <td align="right" height="40px" style="background-image:url(imagenes_cofranet/fondo_pestanas.png); background-repeat:repeat-x; background-position:0px 0px;">
  64.              
  65.  
  66.              
  67.           </td>
  68.              
  69.           </tr>
  70.           </table>           
  71.                      
  72.                                                      
  73.                     </td>                                    
  74.                     </tr>
  75.                      
  76.                     <tr>
  77.                     <td width="800px" style="padding:25px 25px 25px 25px; border-right:solid 1px #dddddd;">
  78.  
  79.  
  80.  
  81.                 <input type="text"  name="page" value="agregar_imagenes" style="width:340px; display:none;"/>  
  82.  
  83.  
  84.                 <table  border="0" align="center" width="100%">
  85.                
  86.                 <tr>
  87.                         <td><span style="font-color:#666666; font-size:10pt; font-weight:bold;">Subir imagenes:</span></td>
  88.                 </tr>
  89.                                
  90.                 <tr>
  91.                         <td>
  92.                           <form id="form1" name="form1" action="">
  93.                           <span style="font-color:#666666; font-size:10pt; font-weight:bold;">Selecciona las imagenes:</span>
  94.                          
  95.                           <input type="text" name="description" id="description" value="<?php echo $_GET['Ngaleria'] ?> " />
  96.                           <input id="file_upload" name="file_upload" type="file" />
  97.                           <a href="javascript:$('#file_upload').uploadifyUpload();" class="Estilo_Boton_Cuotas" style="position:relative; top:40px;">Subir imagenes</a>
  98.         </form>
  99.                                      </td>
  100.                    </tr>
  101.                                      <tr>
  102.                                      <td style="padding-top:20px;">
  103.                                                          
  104.    
  105.                                      
  106.                                      </td>
  107.                 </tr>
  108.                 </table>
  109.                                
  110.              
  111.                            
  112.                      </td>
  113.                      
  114.                      <td valign="top" style="background-color:#f8f8f8; margin:0px 0px 20px 0px; border-right:solid 1px #ffffff; border-top:solid 1px #ffffff;">
  115.                      <div style="width:100%; height:28px; align:left; margin:0px 0px 20px 0px; padding:5px 0px 0px 0px; background-color:#eeeeee;">
  116.                      <font color="#666666" size="2" style="padding:0px 0px 0px 10px;"><strong> </strong></font>
  117.                      </div>                  
  118.  
  119.                    
  120.                      <div style="margin:25px 15px 10px 15px; padding-bottom:10px; border-bottom:solid 0px #cccccc;">
  121.                      <span style="font-size:10pt; color:#666666; font-weight:bold;"></span>
  122.                      </div>
  123.                                                                        
  124.                      </td>                               
  125.                      </tr>
  126.                      </table>                          
  127.  
  128.  
  129.  
  130. <?/*
  131. session_start();
  132. include_once('cerrar_session.php');
  133. */
  134.  
  135.  
  136. ?>
  137.  
  138. </body>
  139. </html>

y este el php:

Código PHP:
Ver original
  1. <?php
  2. include ('conexion.php');
  3. include_once('js_galeria/resize.php'); 
  4.  
  5.    
  6. if (!empty($_FILES)) {
  7.     $tempFile = $_FILES['Filedata']['tmp_name'];
  8.     $Tipo = $_FILES['Filedata']['type'];
  9.   $imagen = $_FILES["Filedata"]["name"];   
  10.   $tmp_name = $_FILES["Filedata"]["tmp_name"]; 
  11.     $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
  12.     $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];        
  13.  
  14.  
  15.  
  16.                        
  17.             if(isset($_POST)) {
  18.  
  19.   echo $_GET['Ngaleria'];
  20.   echo $Ngaleria;
  21.   echo $_SESSION['Ngaleria'] = $Ngaleria;
  22.  
  23.              
  24.                 $_POST['file_upload'];
  25.  
  26.                 $_POST['description'];
  27.                                         echo $consulta = 'INSERT imagenes  (Ncofradia, Ngaleria, descripcion, imagen) VALUES (\''.$_SESSION['Ncofradia'].'\', \''.$_POST['description'].'\', \''.$_POST['description'].'\', \''.$_POST['name'].'\')';
  28.                             mysql_query($consulta, $conexion);
  29.                                        
  30.                                         $id_imagen = mysql_insert_id($conexion);
  31.                                        
  32.                     $valores = explode(".", $imagen);
  33.                                                            
  34.                     $extension = $valores[count($valores)-1];
  35.                                    
  36.                                        
  37.                                         $imagen = $_SESSION['Ncofradia'].'_'.$id_imagen.'.'.$extension;
  38.                                        
  39.                                         $consulta_nombre_imagen = 'Update imagenes Set imagen = "'.$imagen.'" Where Nimagen = "'.$id_imagen.'"';                               
  40.                                            
  41.                                         mysql_query($consulta_nombre_imagen, $conexion) or die(mysql_error()); 
  42.                                        
  43.                                 move_uploaded_file($tmp_name, "imagenes_galerias/$imagen"); # Guardar el archivo en una ubicaci?n, debe tener los permisos necesarios                                                                      
  44.  
  45.                        
  46.                                 $thumb=new thumbnail('imagenes_galerias/'.utf8_decode($imagen));
  47.                     $thumb->size_width(200);
  48.                     $thumb->jpeg_quality(70);
  49.                     $thumb->save('imagenes_galerias_thumb/'.utf8_decode($imagen)); 
  50.                                
  51.                                 $thumb=new thumbnail('imagenes_galerias/'.utf8_decode($imagen));
  52.                     $thumb->size_width(700);
  53.                     $thumb->jpeg_quality(90);
  54.                     $thumb->save('imagenes_galerias_700xx/'.utf8_decode($imagen));     
  55.                                                                
  56.  
  57.               echo 'buena';
  58.     }
  59.  
  60. }
  61. ?>

A ver si alguien sabe un poquito del tema y puede orientarme, ahora mismo guarda dos registros en la base de datos cada vez que sube una imgen, el primero no guarda el Ngaleria y el segundo no guarda la extension del archivo.

Un saludo amigos

Etiquetas: ajax, funcion, html, input, javascript, js, php, variables
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 19:21.