一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

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

时间:2014-12-21 编辑:简简单单 来源:一聚教程网

阿里云 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;
}
?>



   
       
       
       
   
   
       

添加操作


       

           

            名称:
           

 
           
       

 
   

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'));
?>
 


   
       
       
       
   
   
       

 
           
           
           
           
           
           
           
           
           
       

   

上传成功后跳转的页面:

 代码如下 复制代码



     
       
       
   
   
       
       
           
           
       
   

热门栏目