Created
November 7, 2010 18:11
-
-
Save andrerocker/666292 to your computer and use it in GitHub Desktop.
post blog upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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