hi hab nen uplaod script finde aber fehler nicht.
mr wurde das hier vorgeshclagen
aber das geht auch nicht.
es komtm immer datei existiert schon
Code:
<html>
<head>
<title>File-Upload</title>
</head>
<body>
<?php
$target_path = "oneononeladderreps/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if (file_exists("oneononeladderreps/".$file_name)) die ("Eine Datei mit gleichem Namen existiert schon.<br><a href='javascript:history.back(1)'>Zurück</a>");
elseif(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
} ?>
<form enctype="multipart/form-data" action="uploadrepladder.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
mr wurde das hier vorgeshclagen
Code:
<?php
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
if( $_FILES['uploadedfile']['error'] > 0 ) {
echo "There was an error uploading the file, please try again!";
// hier sollte der Fehler noch ausformuliert werden
} else {
$target_path = "oneononeladderreps/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if( file_exists("oneononeladderreps/".$file_name) ) {
echo "Eine Datei mit gleichem Namen existiert schon.<br><a href='javascript:history.back(1)'>Zurück</a>";
} else if( !move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path) ) {
echo 'Datei konnte nicht bewegt werden!';
} else {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
}
} ?> <form enctype="multipart/form-data" action="uploadrepladder.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
es komtm immer datei existiert schon