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> <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/