Hallo!
Ich nutze folgenden Code um Bilder von einem lokalen Rechner auf einen Server zu laden. Leider klappt es nicht mehr.
Ist an dem Code etwas falsch, oder kann mir einer sagen, wie ich den Code dazu bringe eine Fehler auszugeben, den es wohl geben wird?
Danke
Viele Grüße
lakul
Der Code:
<?
//user defined variables
$abpath = "/home0/websites/ke/pds/images/userimages/"; //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/bmp"; //Bmp type
$cert5 = "image/jpg"; //Jpeg type 3
$log = "";
$random1 = rand(1, 99999999);
//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 == $cert5)) {
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert5)) {
$img1_name = $random1 . ".jpeg";
}
if ($img1_type == $cert3) {
$img1_name = $random1 . ".gif";
}
@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>";
}
}
}
// Name speichern:
$fhd = fopen("test.txt", "w"); // Dateiname, schreibbar oeffnen
fwrite($fhd, "$img1_name".$_POST["$img1_name"]); // Variable die an dieses Script via .../schreiben.php?name=Variable
// gesendet wurde in die Datei schreiben
fclose($fhd);
// und wieder schliessen
?>
<html>
<head>
<title></title>
<meta http-equiv="refresh" content="0; URL=http://www.dein-poster.com/index2.php">
</head>
<body>
</body>
</html>