Realize flash avatar upload in PHP

Source: Internet
Author: User

Do a lot of the project to use flash avatar upload, but the internet seems to be hard to find, and I do not use Flash to do. Let's share one today. Share the source at the bottom

First, add the following code where needed:

<style type= "Text/css" media= "screens" > HTML, body {height:100%; Background-color: #ffffff;}
  #flashContent {width:100%; height:100%;} </style> &LT;SC
        Ript type= "Text/javascript" > Function uploadevent (status) {//alert (status);
     Status = = ';
        Switch (status) {case ' 1 ': var time = new Date (). GetTime (); document.getElementById (' Avatar_priview '). InnerHTML = "Avatar 1:  <br/> Avatar 2: <im
                                                                                                        
    G src= ' 2.png "+ Time +" '/><br/> Avatar 3:  ";
     Break
     Break
     Case '-1 ': Window.location.reload ();
     Break
    Default:window.location.reload (); } </script>  

After the correction, look at the upfile.php file.

<?php
$file _src=\ ' #\ '  = Time (). 1.png ";    The names of the different sizes are saved by
$filename = time (). 2.png ";
$filename = Time (). 3.png "; 
$filepath = './uploads/';        Save Address
if (!file_exists ($filepath)) {
    mkdir ('./uploads ');
}
$base 64_decode ($_post[' pic '));
$pic 1=base64_decode ($_post[' pic1 '));  
$pic 2=base64_decode ($_post[' Pic2 '));
$pic 3=base64_decode ($_post[' pic3 '));
if ($src) {
    file_put_contents ($file _src, $src);
}
File_put_contents ($filename 162, $pic 1);
File_put_contents ($filename, $pic 2);
File_put_contents ($filename, $pic 3);
$rs [' status '] = 1;
Print Json_encode ($rs);
? >

Oneself according to need to add some security judgment, this is I look for a flash from the internet, also good and then modified, but some place to change the words need to understand flash, I will not, so if you have a familiar friend words also hope to help. Before the code in place, you can change the address of the submission, as long as the last address do not make a mistake on it. If there are other problems can add group: 2,527,991,671 Discussion

This article is from the "尛 lei" blog, please be sure to keep this source http://a3147972.blog.51cto.com/2366547/1223589

See more highlights of this column: http://www.bianceng.cn/webkf/PHP/

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.