Skip to content

Instantly share code, notes, and snippets.

@andrerocker
Created November 7, 2010 18:11
Show Gist options
  • Save andrerocker/666292 to your computer and use it in GitHub Desktop.
Save andrerocker/666292 to your computer and use it in GitHub Desktop.
post blog upload
<?php
$action = $_REQUEST["acao"];
if($action=="upload-logo")
{
processaLogo();
}
function processaLogo()
{
$logo = processaUploadLogo($_FILES["logo"]);
if(!$logo)
{
header("location: index.php?retorno=upload-invalido");
return;
}
}
function processaUploadLogo($arquivo)
{
$dir = "destino/";
$ale = rand(00,9999);
if (isset($arquivo))
{
$nome = $ale.basename($arquivo["name"]);
if (!move_uploaded_file($arquivo["tmp_name"], $dir.$nome))
return false;
return $nome;
}
return false;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment