elixir-google-api icon indicating copy to clipboard operation
elixir-google-api copied to clipboard

storage upload file with file type

Open DinaWork opened this issue 6 years ago • 1 comments

I manage to upload multipart file to storage but the file type isn't set, how can I set the file type?

GoogleApi.Storage.V1.Api.Objects.storage_objects_insert_simple(
                    Connection.get(), 
                    "my-bucket_id", 
                    "multipart",
                    %{name:"my-file.xml"}, 
                    "path/to/my/file.xml")

storage_file

DinaWork avatar Nov 04 '19 14:11 DinaWork

You have to put the contentType: "text/xml" in the metadata, so:

GoogleApi.Storage.V1.Api.Objects.storage_objects_insert_simple(
                    Connection.get(), 
                    "my-bucket_id", 
                    "multipart",
                    %{name:"my-file.xml", contentType: "text/xml"}, 
                    "path/to/my/file.xml")

robacourt avatar Jul 21 '20 14:07 robacourt