anchor.diff:      end.
   
   
  -% Streams a chunk of data to file from socket (incoming multipart data)
  +%% ensure_unique_filename/2
  +%% ====================================================================
  +%% @doc Tries to create a file until one is created (changing its name every time).
  +%% @end
  +-spec ensure_unique_filename(Req :: req(), Counter :: integer()) -> string() | no_return().
  +%% ====================================================================
   stream_file_to_fslogic(Req, FullPath, BufferSize) ->
  -    case cowboy_req:part_body(Req) of
  +    case cowboy_req:part_body(Req, [{length, BufferSize}, {read_timeout, ?UPLOAD_PART_TIMEOUT}]) of
           {ok, Binary, Req2} ->
               write_to_file(Binary, FullPath),
               Req2;
  
positive.code:     end.
  
  %% ====================================================================
  %% INTERNAL FUNCTIONS - website upload handling
  %% ====================================================================
  
  % Parses a multipart data POST request and returns set of field values and file body
  parse_multipart(Req, Params, Files) ->
      case cowboy_req:part(Req) of
          {ok, Headers, Req2} ->
  
negative.code: %%     case ContentDecode(Data) of
  %%         {ok, Data2} -> {ok, Data2, Req};
  %%         {error, Reason} -> {error, Reason}
  %%     end.