/************************************************/
/* Crea: DNG 2005/12/12 */
/* Descr: Upload a photo album */
/************************************************/
require_once('fctThumb.php');
$message = "";
$directory = "images/";
// Refresh of the data
if (isset($_POST)) {
if(!empty($_POST['action'])) $action = $_POST['action']; else $action = 0;
if(!empty($_POST['imgid'])) $imgid = $_POST['imgid']; else $imgid = 0;
}
// Infos sur l'image
if(isset($_FILES['myphoto'])) {
$nom_fichier = $_FILES['myphoto']['name'];
$taille = $_FILES['myphoto']['size']; // taille en octect, sinon il faut diviser par 1000
$tmp = $_FILES['myphoto']['tmp_name'];
} else {
$nom_fichier = "";
$taille = ""; // taille en octect, sinon il faut diviser par 1000
$tmp = "";
}
/************************************************/
/* Upload the pictures */
/************************************************/
if($action) {
$allowedext_list = array(0 => "image/pjpeg", 1 => "image/gif", 2 => "image/x-png", 3 => "image/jpeg");
if(isset($_FILES['myphoto'])) {
if($_FILES['myphoto']['size'] > 0) {
$fileext = substr(strrchr($_FILES['myphoto']['name'], "."), 1);
$filetype = $_FILES['myphoto']['type'];
if(in_array ($filetype, $allowedext_list)) {
$tempfilename = $_FILES['myphoto']['tmp_name'];
$filename = $imgid.".".$fileext;
$filepath = $directory.$filename;
if (move_uploaded_file($tempfilename, $filepath)) $message = "File uploaded successfully !";
else $message = "File uploaded failed !";
} else {
$message = "The file is not a picture";
}
} else {
$message = "File too big";
}
}
if(is_file($filepath)) {
$dest = $directory;
thumb($directory, $filename, 130, $dest) or die ('
Upload failed while miniaturisation.
');
} else {
$message = "Please contact the administrator: webmaster@verymeet.com";
}
}
?>
| Upload the image |
| Infos sur le fichier: |