Initial commit: Backup der Webseiten
- zoesch.de - blitzkiste.net - gruene-hassberge (norbert.zoesch.de) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
33
zoesch.de/ImageUpload/classes/Uploader.class.php
Normal file
33
zoesch.de/ImageUpload/classes/Uploader.class.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class Uploader
|
||||
{
|
||||
private $filename;
|
||||
private $fileData;
|
||||
private $destination;
|
||||
|
||||
//declare a constructor method
|
||||
public function __construct($key)
|
||||
{
|
||||
$this->filename = $_FILES[$key]['name'];
|
||||
$this->fileData = $_FILES[$key]['tmp_name'];
|
||||
}
|
||||
|
||||
public function saveIn($folder)
|
||||
{
|
||||
$this->destination = $folder;
|
||||
}
|
||||
public function save()
|
||||
{
|
||||
$folderIsWriteAble = is_writable($this->destination);
|
||||
if ($folderIsWriteAble) {
|
||||
$name = "$this->destination/$this->filename";
|
||||
$succes = move_uploaded_file($this->fileData, $name);
|
||||
} else {
|
||||
trigger_error("cannot write to $this->destination");
|
||||
$succes = false;
|
||||
}
|
||||
|
||||
return $succes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user