Skip to content

Instantly share code, notes, and snippets.

@klederson
Created June 10, 2009 13:55
Show Gist options
  • Save klederson/127222 to your computer and use it in GitHub Desktop.
Save klederson/127222 to your computer and use it in GitHub Desktop.
//Abrindo o arquivo para leitura e conversão em STRING
$fp = fopen($tmpName, 'r'); //$tmpName é o nome e caminho completos para o arquivo em disco
//Lendo o arquivo carregado para uma STRING
$content = fread($fp, filesize($tmpName));
//Fechando a conexao com o arquivo
fclose($fp);
//Adicionando slashes para segurança
if(!get_magic_quotes_gpc()) {
$fileName = addslashes($fileName);
}
Lumine::import('OrderProducts');
$orderProductId = $_REQUEST['hidden_id'][$index];
$orderProduct = new OrderProducts();
$orderProduct->get($orderProductId);
//Setando a variavel ( banco ) que irá receber o arquivo
$orderProduct->content = $content;
$orderProduct->content_name = $fileName;
$orderProduct->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment