F diff --git a/php/upload.php b/php/upload.php
--- a/php/upload.php
+++ b/php/upload.php
require_once "node.php";
session_start();
- if (!isset( $_POST["filename"]) || (!isset($_FILES["the_file"]) && (!isset($_POST['content'] || gettype($_POST['content'])!="string"))|| !isset($_POST['parent_directory']) || !isset($_POST['overwrite']))
+ if (!isset( $_POST["filename"]) ||
+ (!isset($_FILES["the_file"]) && (!isset($_POST['content']) || gettype($_POST['content'])!="string"))
+ || !isset($_POST['parent_directory']) || !isset($_POST['overwrite']))
{
error_log("someone tried to upload something impropperly");
http_response_code(400);
$parent_directory=$_POST["parent_directory"];
$user=$_SESSION['user_object'];
$homedir=$user->home_directory;
- $mimetype=file_type($file['tmp_name']);
$overwrite=$_POST['overwrite'];
$dir = get_directory($parent_directory, $user);
+
+ if(isset($_POST['content']))
+ {
+ $mimetype="text/plain";
+ }else
+ {
+ $mimetype=file_type($file['tmp_name']);
+ }
if (!$dir)
{
error_log("trying to upload to invalid directory");