anchor.diff:              {{error, rest_utils:error_reply(ErrorRec)}, Req}
       end.
   
  -%% ====================================================================
  -%% INTERNAL FUNCTIONS - HTTP upload handling
  -%% ====================================================================
  -
  -%% handle_rest_upload/3
  +
  +%% ====================================================================
  +%% INTERNAL FUNCTIONS
  +%% ====================================================================
  +
  +%% parse_http_upload/3
   %% ====================================================================
   %% @doc Parses a multipart data POST request and returns set of field values and
   %% filenames of files that were successfully uploaded.
   %% @end
  --spec parse_multipart(Req :: req(), Params :: [tuple()], Files :: [tuple()]) -> {ok, Params :: [tuple()], Files :: [tuple()]}.
  -%% ====================================================================
  -parse_multipart(Req, Params, Files) ->
  +-spec parse_http_upload(Req :: req(), Params :: [tuple()], Files :: [tuple()]) -> {ok, Params :: [tuple()], Files :: [tuple()]}.
  +%% ====================================================================
  +parse_http_upload(Req, Params, Files) ->
       case cowboy_req:part(Req) of
           {ok, Headers, Req2} ->
               case cow_multipart:form_data(Headers) of
                   {data, FieldName} ->
                       % Form field
                       {ok, FieldBody, Req3} = cowboy_req:part_body(Req2),
  -                    parse_multipart(Req3, [{FieldName, FieldBody} | Params], Files);
  +                    parse_http_upload(Req3, [{FieldName, FieldBody} | Params], Files);
                   {file, _FieldName, Filename, _CType, _CTransferEncoding} ->
                       % File
                       TargetDir = case proplists:get_value(<<"targetDir">>, Params) of
  
positive.code:         {State, NewContext, SessionHandler} ->
              try
                  % Params and _FilePath are not currently used but there are cases when they could be useful
                  {ok, _Params, [{OriginalFileName, _FilePath}]} = parse_multipart(Req, [], []),
  
                  % Return a struct conforming to upload plugin requirements
                  RespBody = rest_utils:encode_to_json(
  
negative.code:         {_, Error} -> {error, Error}
      end.
  
  
  %% create_file_and_required_parent_dirs/2
  %% ====================================================================
  %% @doc Creates all required parent directories to create a file
  %% specified as the last element on the list of subdirectories.
  %% @end
  -spec create_file_and_required_parent_dirs(Path :: string(), [string()]) -> ok | {error, term()}.
  %% ====================================================================
  create_file_and_required_parent_dirs(Path, [Subdir | Subdirs]) ->
      case logical_files_manager:mkdir(Path) of
          ok -> create_file_and_required_parent_dirs(Path ++ Subdir ++ "/", Subdirs);
          {_, Error} -> {error, Error}
      end;
  
  create_file_and_required_parent_dirs(Path, []) ->
      case logical_files_manager:create(Path) of
          ok -> ok;
          {_, Error} -> {error, Error}
      end.
  