Uploadify Multi-image and file upload website application

Source: Internet
Author: User

To download the ZIP package first

Www.uploadify.com/wp-content/uploads/files/uploadify.zip

1, template file reference

<!--quote jquery uploady*}-->
<script src= "Http://www.hq08.cn/public/jquery.js" type= "Text/javascript" charset= "Utf-8" ></script>
<link rel= "stylesheet" type= "Text/css" href= "Http://www.hq08.cn/public/uploadify.css" media= "All" >
<script type= "Text/javascript" src= "Http://www.hq08.cn/public/jquery.uploadify.min.js" ></script>
<!--uploadify Related Settings--
<script type= "Text/javascript" >
$ (function () {
$ (' #file_upload '). Uploadify ({
' FormData ': {
' timestamp ': ' {# $timestamp #} ',
' token ': ' {# $token #} '
},
Be sure to add this code when using PHP, and avoid errors
' ButtonText ': ' Upload ',
' Multi ': true,//allows multiple file uploads
' swf ': ' public/uploadify.swf ',
' Uploader ': ' {#spUrl c=heji a=uploadify#} ',
' Onuploadsuccess ': function (file, data, response) {
$ ('. Touxiang_path '). val (data);
}
});
});
</script>

2. Add a few lines of code to the Code

<div class= "Touxiang" >
<input id= "File_upload" type= "text" name= "Touxiang" >
</div>

<div class= "Touxiang_path" >
<input id= "" type= "text" name= "Touxiang_path" class= "Touxiang_path" style= "width:500px;" >
</div>

Can modify the style arbitrarily, can be more beautiful

3,php Upload Processing

$targetFolder = '/up/';

$verifyToken = MD5 (' Unique_salt '. $_post[' timestamp ');

if (!empty ($_files) && $_post[' token ') = = $verifyToken) {
$tempFile = $_files[' Filedata ' [' tmp_name '];
$targetPath = $handler _dir. '/'. $targetFolder;
$targetFile = RTrim ($targetPath, '/'). ‘/‘ . $_files[' Filedata ' [' name '];

$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. ';
}
}

can set the picture and file size, you can add watermarks, thumbnails, arbitrary processing of pictures, etc.

Uploadify Multi-image and file upload website application

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.