Small program image upload Ali oss use method
First look at the reference document (http://blog.csdn.net/qq_38125123/article/details/73870667)
Here are only some of the problems encountered in the application process and solutions:
1.cryptojs,sha1js,hmacjs,base64js where to download and how to use:
- Files can be found in the OSS instance documentation.
- In the application process if it is introduced through require, will not find the method introduced, because these JS documents do not have a module export, you can find its top global object in the original file, exports out.
- Some global objects are windows, that is to remove Windows, the applet does not have Windows global objects.
```
such as Base64js
var Base64 = {
...//此处省略中间代码}
Module.exports = Base64; Where to modify
```
2. Small program upload OSS to the OSS Management background and applet management background to do the corresponding configuration of the specific reference above document 3. Upload return 400 status, and upload the file storage directory settings where?
- The value of the parameter to be uploaded is important, it should be set reasonably, otherwise it will cause the OSS to not recognize the 400 error.
- The store directory setting is set here in key.
url: LOCAL.uploadImageUrl, filePath: imageSrc, name: ‘file‘, formData: { Filename: `Inquiry/${mediadir}/${userid}/` + ‘${filename}‘, key: `Inquiry/${mediadir}/${userid}/` + ‘${filename}‘, OSSAccessKeyId: LOCAL.OSSAccessKeyId, success_action_status: ‘200‘, policy: policy, signature: signature, },
Applet---> Applet image Upload Application method of Ali Oss