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.
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: ...