sitze atm an einem Uploadscript .. wobei es theoretisch alle Dateien sein könnten aber atm eben fixiert auf Bilder.
Hier der Code ->
<?php
//File Upload Script (C) by Sin
//Options
$scripturl="http://www.url.tdl/scriptfolder/";
$filesizemax=512000; // Filesize in Byte (1 MByte -> 1024 KByte -> 1048576 Byte.
$fileextensions=array(".gif",".png",".jpg",".jpeg"); // Allowd File Extensions
//Options End
// Installation
if(!is_dir("uploads")) //Funzt atm nicht -> der Ordner is irgendwie unbenutzbar O_o?
{
mkdir("uploads",0666);
echo "Directory Created...</br>";
}
//Installation End
//Get Uploads
if($_FILES['uploaded']['temp_name']=="")
{
echo '
<form enctype="multipart/form-data" action="'.$scripturl.'" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="'.$filesizemax.'">
Send this file: <input name="uploaded" type="file">
<input type="submit" value="Send File">
</form>
';
}
$check = $_FILES['uploaded']['name'];
$four=substr($check, -4);
$three=substr($check, -3);
if((in_array($four,$fileextensions))OR(in_array($three,$fileextensions))){
if($_FILES['uploaded']['size']>$filesizemax) die('Filesize is too big.');
if($_FILES['uploaded']['type']=!$fileextensions) die('Wrong Filetype.');
$filehandle = readfile($_FILES['uploaded']['temp_name']);
$filehandle2 = fopen($scripturl."uploads/".$_FILES['uploaded']['name'],"w");
fwrite($filehandle2,$filehandle);
fclose($filehandle2);
echo "File uploaded .... </br>";
echo "URL: ".$scripturl."uploads/".$_FILES['uploaded']['name'];
} else { echo "Filetype isn't allowed."; }
?>
Probleme: mkdir() geht nicht -> der Ordner ist unbrauchbar.
die ganze fwrite geschichte funzt nicht .. und hab atm keine Ahnung warum ...
Also wer lust hat bissel mitzubasteln ..