Skip to content

Instantly share code, notes, and snippets.

@RoverWire
Created July 26, 2010 23:36
Show Gist options
  • Save RoverWire/491448 to your computer and use it in GitHub Desktop.
Save RoverWire/491448 to your computer and use it in GitHub Desktop.
public function uploadify(){
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$NombreCalculado = calcular_id();
$Extension = strtolower(strrchr ($_FILES['Filedata']['name'],"."));
$Ruta = $this->artesania->CarpetaImagen.$NombreCalculado.$Extension;
if(move_uploaded_file($tempFile,'.'.$Ruta)){
$DatosArchivo = array();
$DatosArchivo['ruta'] = $Ruta;
$img = getimagesize('.'.$Ruta);
$DatosArchivo = array_merge($DatosArchivo, $img);
echo json_encode($DatosArchivo);
}else{
echo '0';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment