KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/logicswapweb/aplicaciones/admon/noticias/tb_noticiaimagenes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/logicswapweb/aplicaciones/admon/noticias/tb_noticiaimagenes/prueba1.php
<?php 
function cargar_archivo($destDir,$nameCallback = false,$fieldName = '_upload',$maxFileSize = false){
   
   //make sure something is there
/*  if(!isset($_FILES[$fieldName]) ||!isset($_FILES)||!is_array($_FILES[$fieldName]) ||!$_FILES[$fieldName]['name'])
       return array(false,"El formulario no tiene la etiqueta enctype=\"multipart/form-data\"");//array(false,'No files were uploaded. Make sure your form tag\'s enctype was set to multipart/form-data and that the right field is being checked for the uploaded file.');
*/   
   //normalize the file variable
   $file = $_FILES[$fieldName];
   if (!isset($file['type']))      $file['type']      = '';
   if (!isset($file['size']))      $file['size']      = '';
   if (!isset($file['tmp_name']))  $file['tmp_name']  = '';
   $file['name'] = preg_replace(
             '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
             ,'',str_replace(array(' ','%20'),array('_','_'),$file['name']));
   
   //was it to big?
   if($maxFileSize && ($file['size'] > $maxFileSize))
       return array(false,"El tama�o del archivo es muy grande");//array(false,'The file uploaded was to large.');
   
   //normalize destDir
   if(strlen($destDir)>0 && $destDir[strlen($destDir)-1] != "/")
       $destDir = $destDir.'/';
       
   //should we change the filename via a callback?
   if($nameCallback)
       $file['name'] = call_user_func_array($nameCallback, array($file,$destDir));
   
   $i = 0;    
   //if the filename already exists, append _copy_x (with extension)
   if(strpos($file['name'],'.') !== false){
       $bits = explode('.',$file['name']);
       $ext = array_pop($bits);
       while(file_exists($destDir.implode('.', $bits).($i?'_copy_'.$i:'').'.'.$ext)){
           ++$i;
           $file['name'] = implode('.',$bits).($i?'_copy_'.$i:'').'.'.$ext;
       }
   //if the filename already exists, append _copy_x (no extension)
   } else {
       while(file_exists($destDir.$file['name'].($i ?'_copy_'.$i:''))){
           ++$i;
           $file['name'] = $file['name'].($i?'_copy_'.$i:'');
       }
   }
   
   //and now the big moment
   if(!@copy($file['tmp_name'], $destDir.$file['name']))
       return array(false,"Permiso denegado para copiar el archivo!");//array(false,'Could not write the file "'.$file['name'].'" to: "'.$destDir.'". Permission denied.');
   else
       return array(true,$file['name']);
} 
$i=0;
 $file = $_FILES["dat"]["tmp_name"]["foto"];
list($nombre, $extension) = explode('.', $_FILES["dat"]["name"]["foto"]);
unlink('./../img/f2c21.jpg');
/*while(file_exists('./../img/'. $nombre.($i?'_copy_'.$i:'').'.'.$extension)){
   ++$i;
   $_FILES["dat"]["name"]["foto"] = $nombre.($i?'_copy_'.$i:'').'.'.$extension;
}

   if(!@copy($_FILES["dat"]["tmp_name"]["foto"], './../img/'.$_FILES["dat"]["name"]["foto"]))
       echo "Permiso denegado para copiar el archivo!";
   else
       echo $_FILES["dat"]["name"]["foto"];*/
	   
	
//paa corregir el error debo:
//	1. Tener solo campos de tipo fyle
//	2. Cargar a al memoria del servidor utilizando submit
//	3. Validar la existencia de la foto
//	4. Validar los par�metros de la foto
//	5. copiar la foto al servidor
//	6. Insertar la informaci�n en la base de datos
?>

Anon7 - 2021