Method: Gitlab::Client::Projects#upload_file

Defined in:
lib/gitlab/client/projects.rb

#upload_file(id, file_fullpath) ⇒ Gitlab::ObjectifiedHash

Uploads a file to the specified project to be used in an issue or merge request description, or a comment.

Examples:

Gitlab.upload_file(1, '/full/path/to/avatar.jpg')

Parameters:

  • id (Integer, String)

    The ID or path of a project.

  • file_fullpath (String)

    The fullpath of the file you are interested to upload.

Returns:

See Also:

[View source]

589
590
591
# File 'lib/gitlab/client/projects.rb', line 589

def upload_file(id, file_fullpath)
  post("/projects/#{url_encode id}/uploads", body: { file: File.open(file_fullpath, 'r') })
end