te lo riposto in php:
Codice PHP:
// Image Uploading ...
$dir = "../images_music";
$types = array("image/png","image/x-png","image/gif","image/jpeg","image/pjpeg","audio/x-aiff","video/mp4","audio/x-wav","audio/x-mpeg-3","audio/x-ms-wma","audio/mpeg3","audio/mp4","audio/mpeg","audio/x-mpegurl","audio/mp4a-latm","video/flv","video/x-flv","application/octet-stream","application/x-rar-compressed","application/zip");
$fullpath = "$dir/";
if (!empty($_FILES['foto_1']['name'])) {
if ($_FILES['foto_1']['size'] == 0) {
$message = '[b]Errore:[/b] Foto 1 (0 byte)
« [url="javascript:history.go(-1)"]Indietro![/url]</p>';
die($message);
} elseif ($_FILES['foto_1']['size'] > 4194304) {
$message = '[b]Errore:[/b] Foto 1 Dimensione troppo grande!(Max.: 4 Mb)
« [url="javascript:history.go(-1)"]Indietro![/url]</p>';
die($message);
}
$foto_1_tmp_name = $_FILES['foto_1']['tmp_name'];
$foto_1_new_name = $_FILES['foto_1']['name'];
$foto_1_clean_name = substr($foto_1_new_name, -4);
$foto_1_date = randomkeys(10);
$foto_1 = $foto_1_date . $foto_1_clean_name;
if (in_array($_FILES['foto_1']['type'], $types)) {
move_uploaded_file($foto_1_tmp_name, $fullpath . $foto_1);
} else {
$message = '[b]Errore Foto 1:[/b] Estensione file non supportata!';
die($message);
}
}
if (!empty($_FILES['brano']['name'])) {
if ($_FILES['brano']['size'] == 0) {
$message = '[b]Errore:[/b] MP3 (0 byte)
« [url="javascript:history.go(-1)"]Indietro![/url]</p>';
die($message);
} elseif ($_FILES['brano']['size'] > 8388608) {
$message = '[b]Errore:[/b] MP3 (Max.: 8 Mbyte)
« [url="javascript:history.go(-1)"]Indietro![/url]</p>';
die($message);
}
$brano_tmp_name = $_FILES['brano']['tmp_name'];
$brano_new_name = $_FILES['brano']['name'];
$brano_clean_name = substr($brano_new_name, -4);
$brano_date = randomkeys(10);
$brano = $brano_date . $brano_clean_name;
if (in_array($_FILES['brano']['type'], $types)) {
move_uploaded_file($brano_tmp_name, $fullpath . $brano);
} else {
$message = '[b]Errore MP3:[/b] Estensione file non supportata!';
die($message);
}
}