anchor.diff:  		_ -> error
   	end.
   
  -create_object(State, Container, Object, Data, Options) ->
  -	Headers = [{"Etag", md5(Data)} | parse_object_options(Options)],
  +upload_object(State, Container, Object, FileName) ->
  +	upload_object(State, Container, Object, FileName, [], []).
  +
  +upload_object(State, Container, Object, FileName, Metadata) ->
  +	upload_object(State, Container, Object, FileName, Metadata,[]).
  +
  +upload_object(State, Container, Object, FileName, Metadata, Options) ->
  +	case file:read_file(FileName) of
  +		{ok, FileData} ->
  +			create_object(State, Container, Object, FileData, Metadata, Options);
  +		{error, ErrorMessage} -> {error, ErrorMessage};
  +		_ -> error
  +	end.
  +
  +create_object(State, Container, Object, Data) ->
  +	create_object(State, Container, Object, Data, [], []).
  +
  +create_object(State, Container, Object, Data, Metadata) ->
  +	create_object(State, Container, Object, Data, Metadata, []).
  +
  +create_object(State, Container, Object, Data, Metadata, Options) ->
  +	%get any options that will be passed to ibrowse (chunked etc.)
  +	ConnOptions = get_object_options(Options),
  +	
  +	% Compress the object if required
  +	NewData = compress_object(Data, Options),
  +	
  +	%calculate an MD5 hash of the object and append any headers (metadata) etc.
  +	Headers = [{"Etag", md5(NewData)}] ++ get_object_headers(Options) ++ create_metadata_headers("X-Object-Meta-", Metadata),
   	io:format("~p~n", [Headers]),
  -	{ok, Code, Header, Content} = send_authed_query(State, "/" ++ Container ++ "/" ++ Object, Headers, put, Data),
  +	{ok, Code, _Header, _Content} = send_authed_query(State, "/" ++ Container ++ "/" ++ Object, Headers, put, NewData, ConnOptions),
   
   	case list_to_integer(Code) of
   		201 -> ok;
  
positive.code: 		_ -> error
  	end.
  
  %%
  %% Sends a simple authed query to the server with a passed method
  %%
  
negative.code: 			_ -> extract_metadata_headers(Prefix, HeaderList)
  	end.
  
  get_object_headers([]) -> [];
  get_object_headers([{Option, Value}|Options]) ->
  	case Option of
  		delete_at -> [{"X-Delete-At", Value} | get_object_headers(Options)];
  		delete_after -> [{"X-Delete-After", Value} | get_object_headers(Options)];
  		compressed -> [{"Content-Encoding", "gzip"} | get_object_headers(Options)];
  		content_type -> [{"Content-Type", Value} | get_object_headers(Options)];
  		_ -> get_object_headers(Options)
  	end.
  
  get_object_option(Option, OptionsList) ->
  	case lists:keyfind(Option, 1, OptionsList) of
  		{compressed, true} -> true;
  		{chunked, true} -> true;
  		_ -> false
  	end.
  
  get_object_options([]) -> [];
  get_object_options([{Option, _Value}|Options]) ->
  	case Option of
  		chunked -> [{transfer_encoding, {chunked, 1024}} | get_object_options(Options)];
  		_ -> get_object_options(Options)
  	end.
  
  %%
  