file upload script: url ausgabe

phil-ip

Erfahrenes Mitglied
hey, ich hab im netz ein file upload script gefunden. ich möchte nun allerdings noch eine echo ausgabe machen, in der der pfad und der dateiname angegeben wird. hab leider kaum ne ahnung von php:

gruß

index.php
Code:
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>

upload.php
Code:
<?php
$target = "files/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is our size condition... 350000 = 350k
if ($uploaded_size > 5000000)
{
echo "Your file is too large.<br>";
$ok=0;
}

//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded.";
echo " Url: http://www.xxx.de/files/";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
 
was man nicht alles mit 'nem bisschen forschen und lesen erlangen kann!
Code:
echo " http://www.xxx.de/";
echo $target;

gruß ;)
 

Neue Beiträge

Zurück