From 7541734770d97dc071878953cd043d4dec784864 Mon Sep 17 00:00:00 2001 From: Uncledaviss Date: Tue, 21 May 2024 16:56:50 +0200 Subject: [PATCH] goofin around --- php.ini | 1 + stranky/FileUpload.html | 17 ++++++++++++ stranky/Stranka.code-workspace | 8 ++++++ upload.php | 49 ++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 php.ini create mode 100644 stranky/FileUpload.html create mode 100644 stranky/Stranka.code-workspace create mode 100644 upload.php diff --git a/php.ini b/php.ini new file mode 100644 index 0000000..75b8e87 --- /dev/null +++ b/php.ini @@ -0,0 +1 @@ +file_uploads = On \ No newline at end of file diff --git a/stranky/FileUpload.html b/stranky/FileUpload.html new file mode 100644 index 0000000..b4bd3d6 --- /dev/null +++ b/stranky/FileUpload.html @@ -0,0 +1,17 @@ + + + + + + Document + + + +
+ Select image to upload: + + +
+ + + \ No newline at end of file diff --git a/stranky/Stranka.code-workspace b/stranky/Stranka.code-workspace new file mode 100644 index 0000000..bab1b7f --- /dev/null +++ b/stranky/Stranka.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": ".." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/upload.php b/upload.php new file mode 100644 index 0000000..8814d3d --- /dev/null +++ b/upload.php @@ -0,0 +1,49 @@ + 500000) { + echo "Sorry, your file is too large."; + $uploadOk = 0; +} + +// Allow certain file formats +if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" +&& $imageFileType != "gif" ) { + echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; + $uploadOk = 0; +} + +// Check if $uploadOk is set to 0 by an error +if ($uploadOk == 0) { + echo "Sorry, your file was not uploaded."; +// if everything is ok, try to upload file +} else { + if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { + echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded."; + } else { + echo "Sorry, there was an error uploading your file."; + } +} +?> \ No newline at end of file