Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("../../zp-core/admin-globals.php");
- $path = "../../albums/fan/";
- $valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
- if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") {
- $name = $_FILES['photoimg']['name'];
- $size = $_FILES['photoimg']['size'];
- if(strlen($name)) {
- list($txt, $ext) = explode(".", $name);
- $format_ok = 0;
- foreach ($valid_formats as $mime) {
- if ($_FILES['photoimg']['type'] == ("image/".$mime)) {
- $format_ok = 1;
- }
- }
- if(in_array($ext,$valid_formats) && $format_ok) {
- if($size<(1024*1024)) { // Image size max 1 MB
- $actual_image_name = time().".".$ext;
- $tmp = $_FILES['photoimg']['tmp_name'];
- if(move_uploaded_file($tmp, $path.$actual_image_name)) {
- @chmod($path.$actual_image_name, 0666 & CHMOD_VALUE);
- $gallery = new Gallery();
- $album = new Album($gallery, "fan");
- $image = newImage($album, $actual_image_name);
- $image->setTags($_POST['tag']);
- $image->setOwner("anonymous");
- $image->save();
- echo "Upload eseguito con successo. Una volta moderata l'immagine verrĂ pubblicata. Grazie!";
- } else
- echo "FAIL";
- } else
- echo "Dimensione massima del file: 1 MB";
- } else
- echo "Formato file non valido";
- } else
- echo "Seleziona un'immagine...!";
- exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment