Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huobazi/qiniu_direct_uploader
A gem can direct upload your files to a Qiniu storage bucket
https://github.com/huobazi/qiniu_direct_uploader
qiniu qiniu-storage-bucket ruby
Last synced: 6 days ago
JSON representation
A gem can direct upload your files to a Qiniu storage bucket
- Host: GitHub
- URL: https://github.com/huobazi/qiniu_direct_uploader
- Owner: huobazi
- License: mit
- Created: 2013-09-11T10:01:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-05-02T03:03:00.000Z (over 7 years ago)
- Last Synced: 2024-10-01T18:09:22.144Z (about 1 month ago)
- Topics: qiniu, qiniu-storage-bucket, ruby
- Language: Ruby
- Homepage: https://huobazi.github.com/qiniu_direct_uploader/
- Size: 22.5 KB
- Stars: 27
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Qiniu Direct Uploader
[![Gem Version](https://badge.fury.io/rb/[email protected]?0.0.8)](http://badge.fury.io/rb/qiniu_direct_uploader)
This Gem can direct upload your files to a Qiniu storage bucket.
## Installation
Add this line to your application's Gemfile:
gem 'qiniu_direct_uploader'
And then execute:
$ bundle
Or install it yourself as:
$ gem install qiniu_direct_uploader
## Usage
see the example project: https://github.com/huobazi/qiniu-direct-upload-example
### Views
```erb
<%= qiniu_uploader_form callback_url: items_path,
bucket: 'spec-test',
id: "photograph-uploader",
save_key: "uploads/items/$(year)/$(mon)/$(day)/$(etag)/$(fname)",
custom_fields: {aaa:1,bbb:2},
progress_bar_id: 'progress-bar',
drop_paste_zone_id: 'dropzone' do %>
<% end %>
```see the save_key settings: http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html#magicvar
### Javascript
```coffee
$(document).ready ->
photoForm = $("form#photograph-uploader")
if photoForm.length > 0
photoForm.QiniuUploader
# see also https://github.com/blueimp/jQuery-File-Upload/wiki/Options
autoUpload: true
singleFileUploads: false
limitMultiFileUploads: 2
customCallbackData: {"xyz": 100}
onFilesAdd: (file) ->
if file.type != "image/jpeg"
alert('please select image')
return false
else
return truephotoForm.bind "ajax:success", (e, data) ->
console.log('success')
console.log(data)photoForm.bind "ajax:failure", (e, data) ->
console.log('failure')
console.log(data)
```see also:
1. http://docs.qiniu.com/api/v6/put.html#upload-without-callback
2. http://docs.qiniu.com/api/v6/put.html#upload-api
3. http://docs.qiniu.com/api/v6/put.html#uploadToken-returnBody## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request## Contributors
See the [Contributors List](https://github.com/huobazi/qiniu_direct_uploader/graphs/contributors).
## CHANGE LOG
See the [CHANGELOGS.md](https://github.com/huobazi/qiniu_direct_uploader/blob/master/CHANGELOG.md).