Applet---> Applet image Upload Application method of Ali Oss

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.