From 69c0fe415a55a6fb5935c63955a450735f1d0c9e Mon Sep 17 00:00:00 2001 From: liako <108364802+mantashashvili@users.noreply.github.com> Date: Fri, 9 Sep 2022 23:53:54 +0400 Subject: [PATCH 1/2] Add files via upload --- index.php | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ validation.php | 60 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 index.php create mode 100644 validation.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..2a887f4 --- /dev/null +++ b/index.php @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ +
+ + +
+ + +
+ + + + + + + + +
+ + + + + + +
+ + "> + +
+ + + + + + + diff --git a/validation.php b/validation.php new file mode 100644 index 0000000..36df37f --- /dev/null +++ b/validation.php @@ -0,0 +1,60 @@ + + "image/jpg", + "jpeg" => "image/jpeg", + "gif" => "image/gif", + "png" => "image/png"); + $profile_image_url = NULL; + $ext = pathinfo($porfile_image, PATHINFO_EXTENSION); + if (!array_key_exists($ext, $allowed_ext)) { + $file_error="please choose image"; + } + if(in_array($_FILES["profileimage"]["type"], $allowed_ext)) { + if(!file_exists($target_dir)) { + mkdir($target_dir); + } + if(move_uploaded_file($_FILES["profileimage"]["tmp_name"], $target_dir . $porfile_image) ){ + $profile_image_url = $target_dir.$porfile_image; + } + } + } + +} + + + + \ No newline at end of file From 64eb2e7d7ea149ba498cf3399b28e6f44e38a765 Mon Sep 17 00:00:00 2001 From: liako <108364802+mantashashvili@users.noreply.github.com> Date: Sat, 10 Sep 2022 23:27:02 +0400 Subject: [PATCH 2/2] Update index.php --- index.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/index.php b/index.php index 2a887f4..1ea718a 100644 --- a/index.php +++ b/index.php @@ -30,22 +30,10 @@
- - - - - - - - - - - -