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:
29
zoesch.de/ImageUpload/views/upload.php
Normal file
29
zoesch.de/ImageUpload/views/upload.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
//complete source code for views/upload.php
|
||||
//$newImageSubmitted is TRUE if form was submitted, otherwise FALSE
|
||||
$newImageSubmitted = isset($_POST['new-image']);
|
||||
if ($newImageSubmitted) {
|
||||
//this code runs if form was submitted
|
||||
$output = upload();
|
||||
} else {
|
||||
//this runs if form was NOT submitted
|
||||
$output = include_once 'views/upload-form.php';
|
||||
}
|
||||
|
||||
return $output;
|
||||
//declare new function
|
||||
function upload()
|
||||
{
|
||||
include_once 'classes/Uploader.class.php';
|
||||
//image-data is the name attribute used in <input type='file' />
|
||||
$uploader = new Uploader('image-data');
|
||||
$uploader->saveIn('img');
|
||||
$fileUploaded = $uploader->save();
|
||||
if ($fileUploaded) {
|
||||
$out = 'new file uploaded';
|
||||
} else {
|
||||
$out = 'something went wrong';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
Reference in New Issue
Block a user