Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

How to upload files to repository files list? #1451

@p3tr0v

Description

@p3tr0v

Hi guys, I'm trying to upload a file then see it in repository file list.
I saw issue number #1272 , it solved part of the problem.
The method client.Projects.UploadFile() upload the file, but the file isn't listed in repository file listed. To be true, I didn't find the uploaded file in anywhere in my gitlab, there is only the "Readme.md" file!
This is my code

		bodyFileimage, _ := ioutil.ReadFile(string(bytes.TrimSpace([]byte("save.png"))))
		reader := bytes.NewReader(bodyFileimage)
	
		fi, _, err := client.Projects.UploadFile(projectID, reader, "save.png")
		if err != nil {
			fmt.Println(err)
		}
		fmt.Println(fi.URL)

The output of fmt.Println is
/uploads/b0dc0d16f4476470baae543eb97c3449/save.png

If I copy and paste this URL in my project I see the image, but not in repository list.

I'm using GitLab 14.9.3

Thanks very much

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions