Skip to content

Commit

Permalink
renew php-files
Browse files Browse the repository at this point in the history
  • Loading branch information
tschuhmacher committed Aug 21, 2019
1 parent 37b2416 commit 1c6d05d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 64 deletions.
23 changes: 0 additions & 23 deletions createConfig.php

This file was deleted.

15 changes: 5 additions & 10 deletions server/api/createConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@
$data = file_get_contents("php://input");

$decodedData = json_decode($data);
print_r($decodedData);
if (
!empty($decodedData)
&& property_exists($decodedData, 'content') && !empty($decodedData->content)
&& property_exists($decodedData, 'name') && !empty($decodedData->name)
) {

if($_SERVER[SERVER_NAME] === 'localhost'){
file_put_contents(
__DIR__.'/../../public/' . $decodedData->name,
json_encode($decodedData->content)
);
}else {
file_put_contents(
file_put_contents(
__DIR__.'/' . $decodedData->name,
json_encode($decodedData->content)
);
}
);

echo __DIR__.'/' . $decodedData->name;

http_response_code(200);
} else {
Expand Down
6 changes: 4 additions & 2 deletions server/api/uploadFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
$imageExtensions = ['jpg', 'jpeg', 'png'];

//path where will be file uploaded
$path = !in_array($fileExtension, $imageExtensions) ? __DIR__.'/../../public/models/' : __DIR__.'/../../public/img/';
$path = !in_array($fileExtension, $imageExtensions) ? __DIR__.'/'.'models/' : __DIR__.'/'.'img/';
echo $path;


//allowed file extension for simple validation
$allowedExtensions = ['jpg', 'jpeg', 'png', 'json', 'gltf'];
Expand All @@ -24,4 +26,4 @@
http_response_code(503);
}

?>
?>
29 changes: 0 additions & 29 deletions uploadFile.php

This file was deleted.

0 comments on commit 1c6d05d

Please sign in to comment.