search
Homephp教程PHP源码阿里云OSS利用iframe实现图片异步上传

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

<script>ec(2);</script>

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

index.php:

 代码如下 复制代码

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

";<br>
    var_dump($_POST);<br>
    die;<br>
}<br>
?>
<p><br>
<br>
    </p><br>
        <title></title><br>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><br>
        <script src="http://filela.b0.upaiyun.com/js/jquery-1.9.0.min.js"></script><br>
    <br>
    <br>
        <h1 id="添加操作">添加操作</h1><br>
        

           

            名称:
           

 
           
       

 
   

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实现图片异步上传
            <script><br /> $(function(){<br /> alert('上传成功');<br /> window.parent.$('#res').append("<input type='hidden' value='<?php echo $img ?>' name='path'>")<br /> })<br /> </script>
       
   
Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment