Uploadify realize seven cow cloud storage display upload Progress + page display, uploadify qiniu _php Tutorial

Source: Internet
Author: User

Uploadify realize seven cow cloud storage display upload Progress + page display, uploadify Qiniu


Get ready:

Uploadify Download Address:

http://www.uploadify.com/download/

Seven Bull PHP-SDK Development Guide:

Http://developer.qiniu.com/docs/v6/sdk/php-sdk.html

PHP-SDK Address:

Https://github.com/qiniu/php-sdk

Begin:

DEMO:

http://hxend.com/uploadif/

Become a standard user after registering an account with seven cows

Free storage space 10GB
Free monthly Download Traffic 10GB
Free Put/delete 100,000 requests per month
Free monthly get 1 million requests

It seems to be a good benefit.

After successful registration, the Account page has AK and SK key can be used in the code.

Download good uploadify and put the contents of the seven-ox PHP-SDK package inside the uploadify.

Open the uploadify.php file code as follows:

 
  *///Define a destination$targetfolder = '/uploads '; Relative to the Root$verifytoken = MD5 (' Unique_salt '. $_post[' timestamp '); if (!empty ($_files) && $_post[' Tok En '] = = $verifyToken) {$tempFile = $_files[' Filedata ' [' tmp_name ']; $targetPath = $_server[' Document_root ']. $ TargetFolder; $targetFile = RTrim ($targetPath, '/'). '/' . $_files[' Filedata ' [' Name '];//Validate the file Type$filetypes = array (' jpg ', ' jpeg ', ' gif ', ' PNG '); File extensions$fileparts = pathinfo ($_files[' Filedata ' [' name ']); if (In_array ($fileParts [' extension '],$ FileTypes) {move_uploaded_file ($tempFile, $targetFile); Echo ' 1 ';} else {echo ' Invalid file type. ';}}? >

Modify the code as follows: Introduce the inside of the reference code.

 Token (NULL);        $putExtra = new Qiniu_putextra ();        $putExtra->CRC32 = 1;        $tempFile uploadify uploaded temporary file path list ($ret, $err) = Qiniu_putfile ($upToken, $key 1, $tempFile, $putExtra); Upload image to cloud end//return file name to the front desk echo "http://hdimg.qiniudn.com/". $key 1;    The foreground uses the data parameter of the callback function to receive} else {echo ' Invalid file type. '; }}

Front desk index.php modified to: The foreground calls the Echo output value data to operate.

 
  Uploadifive Test
 
  

The data is entered into the page to implement the current page display. The value of the control #txtimg is the data value of the output as the picture address.

Later, if you need an IFRAME call, you can put

document.getElementById (' txtimg '). Src=data;  Data can be transferred to the #txtimg of the parent page.
Parent.document.getElementById (' txtimg '). Src=data;

DEMO:

http://hxend.com/uploadif/

Bowen to Stone and blog Park All, reproduced please indicate the source, convenient update.
Http://www.cnblogs.com/webers/p/4162108.html

http://www.bkjia.com/PHPjc/927205.html www.bkjia.com true http://www.bkjia.com/PHPjc/927205.html techarticle Uploadify achieve seven Cow cloud storage display upload Progress + page display, uploadify qiniu Preparation: uploadify Download address: http://www.uploadify.com/download/Seven Cattle PHP-SDK Development Guide: ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.