![]()
Sto facendo una piccola applicazione per permettere l'upload i qualsiasi tipo di file, doc, pdf, ppt, zip etc... etc... meno che i file .exe
per quanto riguarda i documenti come DOC e PDF e TXT e OPT etc.. non ci sono problemi come non ci sono problemi per le immagini, quando invece provo a caricare un PPT o uno ZIP ...questi non vengono caricati.
La struttura che uso è la seguente:
inclusione della classe [class.upload.php] presa da http://www.verot.net
pagina che carica il file
..mi servirebbe poter caricare anche possibili file come ZIP e altri help mecodice:include('./include/class.upload.php'); $codice_img = rand(10000, 99999); $codice_img2 = rand(100, 800); $associa = $_POST['associa']; $titfile = mysql_real_escape_string($_POST['tit']); $descrizione = mysql_real_escape_string($_POST['descrizione']); $handle = new Upload($_FILES['file']); if ($handle->uploaded){ $handle->file_new_name_body = $codice_img.'file'.$codice_img2; $handle->Process('./upload/'); $file = $handle->file_dst_name; $handle-> Clean(); } $peso = filesize('./upload/'.$file); $myinsert ="INSERT INTO ftpmanager_files(file, descrizione, peso, oldname) VALUES('$file', '$descrizione', '$peso', '$titfile')"; $result_insert = mysql_query($myinsert) or die('Query failed: ' . mysql_error()); $lastid = mysql_insert_id(); if($associa == 'all'){ $sqlu = "SELECT * FROM ftpmanager_user WHERE livello = 1"; $resu = mysql_query($sqlu); while($rowu = mysql_fetch_array($resu)){ $iduser = $rowu['id']; $myinsert2 ="INSERT INTO ftpmanager_userfile(idfile, iduser, download) VALUES('$lastid', '$iduser', 0)"; $result_insert2 = mysql_query($myinsert2) or die('Query failed: ' . mysql_error()); $iduser = ''; } }else{ $myinsert2 ="INSERT INTO ftpmanager_userfile(idfile, iduser, download) VALUES('$lastid', '$associa', 0)"; $result_insert2 = mysql_query($myinsert2) or die('Query failed: ' . mysql_error()); } header('Location: gestionefile_add2.php?x=dd');

Rispondi quotando
