我试图用shell脚本对图像进行base64编码,并将其放入变量:
test="$(printf DSC_0251.JPG | base64)"
echo $test
RFNDXzAyNTEuSlBH
我也试过这样的方法:
test=\`echo -ne DSC_0251.JPG | base64\`
但仍然没有成功.
我想这样做:
curl -v -X POST -d '{"image":$IMAGE_BASE64,"location":$LOCATION,"time_created":$TIMECREATED}' -H 'Content-type: text/plain; charset=UTF8' http://192.168.1.1/upload
我找到了这个http://www.zzzxo.com/q/answers-bash-base64-encode-script-not-encoding-right-12290484.html
但仍然没有成功.