Current location - Quotes Website - Personality signature - How to upload a picture to Qiniu Cloud Platform?
How to upload a picture to Qiniu Cloud Platform?
The last article introduced "How to upload pictures to Cloudinary cloud platform?"

But because Cloudinary's server is abroad, the speed of uploading and reading pictures will be very slow, which is not suitable for production. Therefore, it is necessary to introduce the popular "seven cows" cloud platform in China. And introduce step by step how to use seven cows.

You can register with my invitation link: /signup? code=3l7nsvonfkxn6

Please. ! !

The object storage space we added here is called "gougouavatar".

Two parameters, ACCESS_KEY and SECRET_KEY, come from the Key Management module of Personal Center:

_getQiniuToken () returns the encapsulated promise function and calls the interface of the background signature generation algorithm;

Parameters such as key generated in the background are obtained in the callback of this function;

Finally, the _upload method is called to send a request to the interface address where Qiniu uploads the picture, and upload the picture;

The last response parameter, response.key, is the address after the image is uploaded successfully.

Such as: deae507d-73fd-4489-9d7f-d5fa275bcbe5.jpeg

To access this image, you need to splice the test domain name provided by Qiniu:

After testing, the upload speed of using Qi Niu is really fast, several times faster than that of foreign cloudinary, and the experience is still very good, so you can use it with confidence.