Last active
September 6, 2017 15:38
-
-
Save rainchen/a2e4b9bbaa87c703d3d0af2e82e3701c to your computer and use it in GitHub Desktop.
Revisions
-
rainchen revised this gist
Sep 6, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,5 +41,5 @@ echo "uploadToken:$uploadToken" echo "Uploading..." echo # add "-v" for debug curl -v -F token="$uploadToken" -F file="@$uploadfile" -F key="$uploadfile" http://upload.qiniu.com/ echo -
rainchen revised this gist
Sep 6, 2017 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,10 @@ #!/bin/bash # refs: # https://segmentfault.com/q/1010000003000974 # http://blog.csdn.net/guoer9973/article/details/46459971 # http://www.cnblogs.com/sink_cup/p/cloud_storage_aliyun_oss_vs_qiniu_rs.html # api: # https://developer.qiniu.com/kodo/api/1312/upload @@ -17,7 +23,7 @@ echo "Upload $uploadfile to $namespace" echo scope="$namespace" deadline=$(expr `date +%s` + 3600) # build policy json putPolicy="{\"scope\":\"$scope\",\"deadline\":$deadline}" -
rainchen revised this gist
Sep 6, 2017 . 1 changed file with 5 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,4 @@ #!/bin/bash # api: # https://developer.qiniu.com/kodo/api/1312/upload @@ -27,19 +21,19 @@ deadline=$(echo `date +%s` + 3600| bc ) # build policy json putPolicy="{\"scope\":\"$scope\",\"deadline\":$deadline}" echo "putPolicy:$putPolicy" data=$(echo -en $putPolicy | base64 | tr "+/" "-_") echo "data:$data" auth=$(echo -en $data | openssl sha1 -hmac $secretkey -binary | base64 | tr "+/" "-_") echo "auth:$auth" uploadToken="$accesskey:$auth:$data"; echo "uploadToken:$uploadToken" echo "Uploading..." echo # add "-v" for debug curl -v -F token="$uploadToken" -F file="$uploadfile" -F key="$uploadfile" -F fileBinaryData=@$uploadfile http://upload.qiniu.com/ echo -
rainchen created this gist
Sep 6, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ #!/bin/bash # refs: # https://segmentfault.com/q/1010000003000974 # http://blog.csdn.net/guoer9973/article/details/46459971 # http://www.cnblogs.com/sink_cup/p/cloud_storage_aliyun_oss_vs_qiniu_rs.html # api: # https://developer.qiniu.com/kodo/api/1312/upload # how-to-access-or-locate-the-access-key-and-secret-key accesskey=$(printenv 'QINIU_AK') secretkey=$(printenv 'QINIU_SK') namespace=$(printenv 'QINIU_NS') if [[ $accesskey == '' ]]; then echo 'QINIU_AK is blank' exit; fi uploadfile=$1 echo "Upload $uploadfile to $namespace" echo scope="$namespace" deadline=$(echo `date +%s` + 3600| bc ) # build policy json putPolicy="{\"scope\":\"$scope\",\"deadline\":$deadline}" # echo "putPolicy:$putPolicy" data=$(echo -en $putPolicy | base64 | tr "+/" "-_") # echo "data:$data" auth=$(echo -en $data | openssl sha1 -hmac $secretkey -binary | base64 | tr "+/" "-_") # echo "auth:$auth" uploadToken="$accesskey:$auth:$data"; # echo "uploadToken:$uploadToken" echo "Uploading..." echo # add "-v" for debug curl -F token="$uploadToken" -F file="$uploadfile" -F key="$uploadfile" -F fileBinaryData=@$uploadfile http://upload.qiniu.com/ echo