Home> php教程> PHP源码> body text

阿里云OSS利用iframe实现图片异步上传

WBOY
Release: 2016-06-08 17:20:59
Original
1334 people have browsed it

阿里云OSS上传工具是阿里云专用的上传功能了,下面我就为各位介绍一个阿里云OSS利用iframe实现图片异步上传了,这个例子非常的简单。

阿里云 OSS 图片上传iframe 实现异步上传 相关代码:

index.php:

代码如下 复制代码

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
if (isset($_POST) && !empty($_POST)) {
echo "

";
var_dump($_POST);
die;
}
?>









添加操作


Copy after login



名称:






upload.php

代码如下 复制代码
$access_id = '';
$access_key = '';
$policy = '{"expiration": "2120-01-01T12:00:00.000Z","conditions":[{"bucket": "ioutsider" },["content-length-range", 0, 104857600]]}';
$policy = base64_encode($policy);
$signature = base64_encode(hash_hmac('sha1', $policy, $access_key, true));
$file_name = date('Y') . '/' . date('m') . '/' . md5(microtime(true)) . '.jpg';
//print_r(get_headers('http://ioutsider.oss-cn-shenzhen.aliyuncs.com'));
?>






















上传成功后跳转的页面:

代码如下 复制代码










阿里云OSS利用iframe实现图片异步上传



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!