Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !8897

Closed
Created Mar 02, 2015 by Administrator@rootOwner
  • Report abuse
Report abuse

+ support upload file

  • Overview 3
  • Commits 2
  • Changes 1

Created by: hemon

why ? when use javascript client post/put file, js can't load the file content and transcode into base64 how ? use multipart/form-data upload file in Form or Ajax is very simple and normal. just check if content contain Tempfile object, then encode in base64.

<form enctype="multipart/form-data" method="post" action="/api/v3/projects/1/repository/files?private_token=">
<input name="file_path" value="image.png">
<input name="branch_name" value="master">
<input name="encoding" value="text">
<input name="commit_message" value="message">
<input type="file" name="content">
<!--input name="content"-->
<input name="_method" value="post">
<input type="submit">
</from>
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/hemon/master