-
Allora sul mio spazio altervista ho inserito un programmino in php per immettere notizie e immagini senza l'ausilio di un ftp per quanto riguarda le news in formato testo il tutto funziona correttamente mentre quando cerco di inviare le immagini questo non accade! vi posto l'indirizzo della pagina per immettere le notizie e lo script utilizzato per inviare le immagini:
http://totolac.altervista.org/flash/news/indice.html
lo script invece č:
<?
$abpath = "/news/immagini"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type
$log = "";
//begin upload 1
//checks if file exists
if ($img1_name == "") {
$log .= "No file selected for upload 1<br>";
}
if ($img1_name != "") {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "File 1 was too big<br>";
}
}
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3) or ($img1_type == $cert4) or ($img1_type == $cert5) or ($img1_type == $cert6) or ($img1_type == $cert7) or ($img1_type == $cert8) or ($img1_type == $cert9) or ($img1_type == $cert10) or ($img1_type == $cert11) or ($img1_type == $cert12) or ($img1_type == $cert13) or ($img1_type == $cert14) or ($img1_type == $cert15) or ($img1_type == $cert16) or ($img1_type == $cert17)) {
@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server<br>";
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 was uploaded<br>";
}
} else {
$log .= "File 1 is not an image<br>";
}
}
}
//checks if file exists
if ($img2_name == "") {
$log .= "No file selected for upload 2<br>";
}
if ($img2_name != "") {
//checks if file exists
if (file_exists("$abpath/$img2_name")) {
$log .= "File 2 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img2_size > $size) {
$log .= "File 2 was too big]<br>";
}
}
//Checks if file is an image
if (($img2_type == $cert1) or ($img2_type == $cert2) or ($img2_type == $cert3) or ($img2_type == $cert4) or ($img2_type == $cert5) or ($img2_type == $cert6) or ($img2_type == $cert7) or ($img2_type == $cert8) or ($img2_type == $cert9) or ($img2_type == $cert10) or ($img2_type == $cert11) or ($img2_type == $cert12) or ($img2_type == $cert13) or ($img2_type == $cert14) or ($img2_type == $cert15) or ($img2_type == $cert16) or ($img2_type == $cert17)) {
@copy($img2, "$abpath/$img2_name") or $log .= "Couldn't copy image 2 to server<br>";
if (file_exists("$abpath/$img2_name")) {
$log .= "File 2 was uploaded<br>";
}
} else {
$log .= "File 2 is not an image<br>";
}
}
}
if ($img3_name == "") {
$log .= "No file selected for upload 3<br>";
}
if ($img3_name != "") {
//checks if file exists
if (file_exists("$abpath/$img3_name")) {
$log .= "File 3 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img3_size > $size) {
$log .= "File 3 was too big<br>";
}
}
//Checks if file is an image
if (($img3_type == $cert1) or ($img3_type == $cert2) or ($img3_type == $cert3) or ($img3_type == $cert4) or ($img3_type == $cert5) or ($img3_type == $cert6) or ($img3_type == $cert7) or ($img3_type == $cert8) or ($img3_type == $cert9) or ($img3_type == $cert10) or ($img3_type == $cert11) or ($img3_type == $cert12) or ($img3_type == $cert13) or ($img3_type == $cert14) or ($img3_type == $cert15) or ($img3_type == $cert16) or ($img3_type == $cert17)) {
@copy($img3, "$abpath/$img3_name") or $log .= "Couldn't copy image 3 to server<br>";
if (file_exists("$abpath/$img3_name")) {
$log .= "File 3 was uploaded<br>";
}
} else {
$log .= "File 3 is not an image<br>";
}
}
}
if ($img4_name == "") {
$log .= "No file selected for upload 4<br>";
}
if ($img4_name != "") {
//checks if file exists
if (file_exists("$abpath/$img4_name")) {
$log .= "File 4 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img4_size > $size) {
$log .= "File 4 was too big<br>";
}
}
//Checks if file is an image
if (($img4_type == $cert1) or ($img4_type == $cert2) or ($img4_type == $cert3) or ($img4_type == $cert4) or ($img4_type == $cert5) or ($img4_type == $cert6) or ($img4_type == $cert7) or ($img4_type == $cert8) or ($img4_type == $cert9) or ($img4_type == $cert10) or ($img4_type == $cert11) or ($img4_type == $cert12) or ($img4_type == $cert13) or ($img4_type == $cert14) or ($img4_type == $cert15) or ($img4_type == $cert16) or ($img4_type == $cert17)) {
@copy($img4, "$abpath/$img4_name") or $log .= "Couldn't copy image 4 to server<br>";
if (file_exists("$abpath/$img4_name")) {
$log .= "File 4 was uploaded<br>";
}
} else {
$log .= "File 4 is not an image<br>";
}
}
}
if ($img5_name == "") {
$log .= "No file selected for upload 5<br>";
}
if ($img5_name != "") {
//checks if file exists
if (file_exists("$abpath/$img5_name")) {
$log .= "File 5 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img5_size > $size) {
$log .= "File 5 was too big<br>";
}
}
//Checks if file is an image
if (($img5_type == $cert1) or ($img5_type == $cert2) or ($img5_type == $cert3) or ($img5_type == $cert4) or ($img5_type == $cert5) or ($img5_type == $cert6) or ($img5_type == $cert7) or ($img5_type == $cert8) or ($img5_type == $cert9) or ($img5_type == $cert10) or ($img5_type == $cert11) or ($img5_type == $cert12) or ($img5_type == $cert13) or ($img5_type == $cert14) or ($img5_type == $cert15) or ($img5_type == $cert16) or ($img5_type == $cert17)) {
@copy($img5, "$abpath/$img5_name") or $log .= "Couldn't copy image 5 to server<br>";
if (file_exists("$abpath/$img5_name")) {
$log .= "File 5 was uploaded<br>";
}
} else {
$log .= "File 5 is not an image<br>";
}
}
}
?>
<html>
<head>
<title>Image Report</title>
</head>
<body>
<p>Log:<br>
<?
echo "$log";
?>
</p>
<a href="indice.html">Torna all'indice</a>
<body>
<html>
se qualcuno riesce a dirmi dov'č il problema mi aiuterebbe parecchiotto!
Grazie!
-
scusami ma i tag body ed html non devi chiuderli??
-
Grazie lo stesso ma ho risolto da me! il problema stava nella definizione di path assoluta!
Grazie ancora a presto!
-
Scusa, ma puoi essere piu' chiaro sulla soluzione del problema?
Interessa anche a me, grazie... :wink:
-
Allora all'inizio dello script come variabile path avevo inserito:
$abpath = "/news/immagini";
ma non funzionava l'inserimento immagini ma se come variabile path ci metto:
$abpath = "/membri/totolac/flash/news/immagini";
cioč l'assoluta massima il tutto funziona bene!
Spero di averti aiutato o almeno chiarito le idee! Ciao.
-
Grazie, tutto risolto.
Ciao :wink: