Skip to content

+ support upload file

gitlab-qa-bot requested to merge github/fork/hemon/master into master

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>

Merge request reports