Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Bom galera... estou fazendo uma galeria de fotos e preciso de um upload múltiplo no caso, estou usando o uploadfy, mas ele está com erro: ele da uma mensagem de completo mas não coloca a imagem na pasta :cry:/>
olha meu código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sem título</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="jquery.uploadify.min.js"></script>
<link rel="stylesheet" type="text/css" href="uploadify.css">
</head>
<body>
<form>
<div id="queue"></div>
<input id="file_upload_1" name="file_upload_1" type="file" multiple="true">
</form>
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
$('#file_upload_1').uploadify({
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'swf' : 'uploadify.swf',
'uploader' : 'upload.php'
});
});
</script>
</body>
</html>
e o upload.php
<?php
require_once 'class.imghandler.php';
ini_set("html_errors", "0");
// Get the session Id passed from SWFUpload. We have to do this to work-around the Flash Player Cookie Bug
if (isset($_POST["PHPSESSID"])) {
session_id($_POST["PHPSESSID"]);
}
// Check the upload
if (!isset($_FILES["file_upload_1"]) || !is_uploaded_file($_FILES["file_upload_1"]["tmp_name"]) || $_FILES["file_upload_1"]["error"] != 0) {
echo "ERROR:invalid upload";
exit(0);
}
$id = $_GET['id'];
$recebeImagem = $_FILES['file_upload_1'];
$diretorio = "imagens/";
$largura_thumb = 150;
$altura_thumb = 90;
$largura = 550;
$altura = 400;
$img = $recebeImagem['tmp_name'];
// Use a output buffering to load the image into a variable
ob_start();
imagejpeg($new_img);
$imagevariable = ob_get_contents();
ob_end_clean();
$ImgHandler = new ImgHandler();
$ImgHandler->setPath($diretorio);
$ImgHandler->setMaxThumbSize($largura_thumb, $altura_thumb);
$ImgHandler->setMaxImgSize($largura, $altura);
$foto = $ImgHandler->saveImg($img);
$ImgHandler->createThumb($foto);
$file_id = basename($foto);
$_SESSION["file_info"][$file_id] = $foto;
echo "FILEID:". $id."/".$file_id;
?>
galera por favor me ajudem tô enlouquecendo já :o/>
Carregando comentários...