aboutsummaryrefslogtreecommitdiffstats
path: root/httpserver/resources/upload.php
diff options
context:
space:
mode:
authormarcinrzepeckiwroc <marcin.rzepecki@nokia.com>2020-12-22 16:23:58 +0100
committermarcinrzepeckiwroc <marcin.rzepecki@nokia.com>2021-01-07 14:54:16 +0100
commit23f606075360a376a8fdb9f7fb1f3505c3100c1a (patch)
treec297a5de42fbd49668db74193673052885f84eea /httpserver/resources/upload.php
parent43d113d683ab082f8e2b7ce062e9601e74ffde3a (diff)
Extend PNF simulator with HTTP server
Issue-ID: INT-1814 Change-Id: I06eeb81e46d6a96976f64eece6bbf7209665c1d2 Signed-off-by: marcinrzepeckiwroc <marcin.rzepecki@nokia.com>
Diffstat (limited to 'httpserver/resources/upload.php')
-rw-r--r--httpserver/resources/upload.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/httpserver/resources/upload.php b/httpserver/resources/upload.php
new file mode 100644
index 0000000..31dbaa3
--- /dev/null
+++ b/httpserver/resources/upload.php
@@ -0,0 +1,18 @@
+<?PHP
+ if(!empty($_FILES['uploaded_file']))
+ {
+ $dirpath = "";
+ $path = $dirpath . basename( $_FILES['uploaded_file']['name']);
+ $filename = $_FILES['uploaded_file']['name'];
+ $filepath = '/usr/local/apache2/htdocs/'.$path;
+
+ if (file_exists($filepath)) {
+ echo "The file $filename exists" .PHP_EOL;
+ } else if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
+ echo "The file ". basename( $_FILES['uploaded_file']['name']).
+ " has been uploaded" .PHP_EOL;
+ } else{
+ echo "There was an error uploading the file, please try again!" .PHP_EOL;
+ }
+ }
+?>