1
0
Fork 0

correccion bug en subida de imagenes

This commit is contained in:
humano 2015-03-09 15:09:52 -05:00
parent 7f80af499d
commit 6d2891c2fe
4 changed files with 55 additions and 32 deletions

View File

@ -494,7 +494,7 @@ else {return $resultado;}
$xajax->registerFunction("aplicaciones_listado");
function contenido_aplicacion($id){
function contenido_aplicacion($id,$plantilla){
$div = "contenedor";
$respuesta = new xajaxResponse('utf-8');
@ -506,37 +506,53 @@ $link=Conectarse();
$sql=mysql_query($consulta,$link);
if (mysql_num_rows($sql)!='0'){
$control = mysql_result($sql,0,control);
//$contenido = "<ul class='dropdown-menu' role='menu'>";
mysql_data_seek($sql, 0);
$contenido = "
";
mysql_data_seek($sql, 0);
$contenido = " ";
$orden = 0;
while( $row = mysql_fetch_array( $sql ) ) {
//$orden = $orden+500;
$identificador = explode(',',$row[identificador]);
$identificador = $identificador[0];
$contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'');
$contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
$titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
$contenido .= "
$contenido_desplegado
";
$contenido .= "$contenido_desplegado ";
}
$contenido = "
$links
<section id=''>$contenido</section>";
$contenido = " $links <section id=''>$contenido</section>";
}
return $contenido;
}
function contenido_aplicacion_nombre($nombre,$plantilla){
$id = remplacetas('form_id','nombre',$nombre,'id',"") ;
$id = $id[0];
if($id[0] =="") {$aviso = "<div class='alert-danger'><h2>No se ha definido una aplicación con el nombre <strong>$nombre</strong></h2> </div>";
return $aviso;}
$campo_titulo = remplacetas('parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
$campo_titulo = $campo_titulo[0];
$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
$link=Conectarse();
$sql=mysql_query($consulta,$link);
if (mysql_num_rows($sql)!='0'){
$control = mysql_result($sql,0,control);
mysql_data_seek($sql, 0);
$contenido = " ";
$orden = 0;
while( $row = mysql_fetch_array( $sql ) ) {
$identificador = explode(',',$row[identificador]);
$identificador = $identificador[0];
$contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
$titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
$contenido .= "$contenido_desplegado ";
}
$contenido = " $links <section id=''>$contenido</section>";
}
//return " $contenido";
// $respuesta->addAssign("$div","innerHTML","$contenido");
return $contenido;
}
@ -733,14 +749,14 @@ if (mysql_num_rows($sql)!='0'){
return $contenido.$control;
}
function contenido_mostrar($id,$control,$div){
function contenido_mostrar($id,$control,$div,$plantilla){
$respuesta = new xajaxResponse('utf-8');
$link=Conectarse();
$sql=mysql_query($consulta,$link);
if (mysql_num_rows($sql)!='0'){
$impresion = formulario_imprimir("$id","$control","c3p");
$impresion = formulario_imprimir("$id","$control","$plantilla");
}
if($div !="") {
@ -1128,7 +1144,7 @@ if (mysql_num_rows($sql)!='0'){
mysql_data_seek($sql, 0);
//$resultado ="<div class='row' >";
$imagen = formulario_valor_campo("$id","0","","$control");
/* $imagen = formulario_valor_campo("$id","0","","$control");
$imagen = $imagen[3];
if($imagen[3] != "") {
$resultado .= "
@ -1143,6 +1159,7 @@ if (mysql_num_rows($sql)!='0'){
$imagen = remplacetas("empresa","id",$id_empresa[0],"imagen","");
$campo[0] = "http://$_SERVER[HTTP_HOST]/milfs/images/100x100.png";
}
*/
while( $row = mysql_fetch_array( $sql ) ) {
$multiple ="$row[multiple]";
$campo_tipo = remplacetas('form_campos','id',$row[id_campo],'campo_tipo');
@ -1152,7 +1169,7 @@ if (mysql_num_rows($sql)!='0'){
$contenido = $contenido[3];
//$contenido = Markdown($contenido);
if($campo_tipo=='15'){if($contenido !=""){$contenido = "<img class='img-thumbnail responsive' src='http://$_SERVER[HTTP_HOST]/milfs/images/secure/?file=300/$contenido'>"; }else{$contenido="";}}
if($campo_tipo=='15' AND $tipo==""){if($contenido !=""){$contenido = "<img class='img-thumbnail responsive' src='http://$_SERVER[HTTP_HOST]/milfs/images/secure/?file=300/$contenido'>"; }else{$contenido="";}}
elseif($campo_tipo=='14'){
if($contenido !='') {

BIN
milfs/images/pixel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View File

@ -7,7 +7,7 @@ session_start();
header("Location: ../nodisponible.jpg");
// echo "hola mundo2";
}*/
if(!isset($_GET['file'])){
if(!isset($_GET['file']) ){
header("Location: ../sinimagen.jpg");
}
@ -26,6 +26,11 @@ if (strpos($ref,'http://')===0 || strpos($ref,'http')!==0){
'mid'=>'audio/x-midi',
'wav'=>'audio/x-wav'
);
if($mime[substr($file,-3)] =='') {
header('Location: ../pixel.png');
exit();
}
$stat=stat($file);
header('Content-Type: '.$mime[substr($file,-3)]);
header('Content-Length: '.$stat[7]);

View File

@ -6,6 +6,7 @@ if ( !isset ( $_SESSION['id'] ) ) {
//header("Location: ../../../includes/error.php");
// echo "hola mundo2";
}
$imagen= $_REQUEST[id_imagen];
if($_REQUEST[u] == "escritorio") {$respuesta = "escritorio/";}
// Script Que copia el archivo temporal subido al servidor en un directorio.
$tipo = $_FILES['fileUpload']['type'];
@ -22,7 +23,7 @@ if (isset($_FILES['fileUpload']['tmp_name'])) {
// $nombre =MD5(time()).".jpg";
// (2) - Comprobamos que se trata de un archivo de imágen
//if ($tipo == 'image/jpeg' AND $size <= 4000000 ) {
if (($tipo == 'image/jpeg' or $tipo =='image/png') AND $size <= 4000000 ) {
if (($tipo == 'image/jpeg' or $tipo =='image/png') AND $size <= 10000000 ) {
// (3) Por ultimo se intenta copiar el archivo al servidor.
$name = MD5(time())."$ext";
$nombre= "../../../images_secure/full/".$name;
@ -37,14 +38,14 @@ else{
echo generar_miniatura_alto($name,"150");
echo generar_miniatura_alto($name,"300");
echo generar_miniatura_alto($name,"600");
echo "<script>parent.resultadoUpload(0, '$name','$respuesta');</script> ";
echo "<script>parent.resultadoUpload(0, '$name','$respuesta','$imagen');</script> ";
}
}
else echo "<script>parent.resultadoUpload(2,'','$respuesta');</script> ";
else echo "<script>parent.resultadoUpload(2,'','$respuesta','$imagen');</script> ";
}
else{
echo '<script>parent.resultadoUpload(3, "");</script> ';
echo "<script>parent.resultadoUpload(3,'','".$imagen."');</script>";
}
function generar_miniatura($file,$width) { //$archivo = $file;