GithubHelp home page GithubHelp logo

xqinwl / cos-wx-upload-file Goto Github PK

View Code? Open in Web Editor NEW

This project forked from piscium2010/cos-wx-upload-file

0.0 0.0 0.0 1.65 MB

微信小程序上传文件到腾讯云v5;Wechat mini program upload file to tencent cos v5

License: MIT License

JavaScript 100.00%

cos-wx-upload-file's Introduction

cos-wx-upload-file

微信小程序上传文件到腾讯云v5

Demo

demo

微信小程序仅支持https请求上传文件,所以我们选择了腾讯云作为文件服务器。此外腾讯云提供了配套小程序开发的SDK,方便微信上传文件时调用。

为了例子的简洁性,这里没有使用服务器鉴权,而采用了前端鉴权

前提

我们假设(哥们儿/妹子)你已经入门微信小程序开发

准备工作

注册腾讯云

COS对象存储控制台 创建存储桶,

填入存储桶名称等基本信息。为了方便测试,选择公有读私有写

为存储桶添加跨域访问规则(重要)

如果你不熟悉跨域访问设置,可参考以下配置

获取你的 Bucket(存储桶名称), Region(地域名称) 和访问域名

控制台密钥管理 获取你的 SecretId 和 SecretKey

登录微信公众平台 设置 --> 开发设置,将你刚才得到的访问域名填入服务器域名

至此,准备工作全部完成

运行项目

git clone https://github.com/piscium2010/cos-wx-upload-file.git

编辑cos-wx-upload-file\pages\index\config.js,替换你的 Bucket, Region, SecretId, SecretKey

运行小程序

写这篇教程就是因为微信的官网教程写得跟___一样,如同意请右上角点赞

羞耻广告位

designare-table: 企业级react table组件, IE11 下性能完胜Ant Design

迅速搭建React源码测试环境

cos-wx-upload-file's People

Contributors

piscium2010 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.