NoteOnMe博客平台搭建
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

117 rader
2.4 KiB

<?php
$a=array("a"=>1,"b"=>2);
if(!empty($_FILES['file']['name'])){
//判断是否有文件
$fileinfo = $_FILES['file']; //将文件信息赋给变量$fileinfo
echo "上传成功";
if($fileinfo['size']<1000000 && $fileinfo['size']>0){ //判断文件大小
move_uploaded_file($_FILES["file"]['tmp_name'],"image/".$fileinfo['name']);
echo "上传成功";
$filepath="image/".$fileinfo['name'];
echo "
<script src='test8.js' type='text/javascript' ></script>
<script>
append_img('$filepath');
</script>
";
$a=2;
}else{
echo '文件太大或未知';
}
}
?>
<html>
<head>
<style>
body {
background-color: #efefef;
}
.profile-pic {
max-width: 200px;
max-height: 200px;
display: block;
}
.circle {
border-radius: 1000px !important;
overflow: hidden;
width: 128px;
height: 128px;
border: 8px solid rgba(255, 255, 255, 0.7);
position: absolute;
top: 72px;
}
img {
max-width: 100%;
height: auto;
}
.p-image {
position: absolute;
top: 167px;
right: 30px;
color: #666666;
transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
}
.p-image:hover {
transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
}
.upload-button {
font-size: 1.2em;
}
.upload-button:hover {
transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
color: #999;
}
</style>
</head>
</html>
<script type="text/javascript" src="jquery.min.js"></script>
<script>
$(document).ready(function() {
var readURL = function(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('.profile-pic').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$(".file-upload").on('change', function(){
readURL(this);
});
$(".upload-button").on('click', function() {
$(".file-upload").click();
});
});
</script>
<div class="row">
<div class="small-12 medium-2 large-2 columns">
<div class="circle">
<!-- User Profile Image -->
<img class="profile-pic" >
<!-- Default Image -->
<!-- <i class="fa fa-user fa-5x"></i> -->
</div>
<div class="p-image">
<i class="fa fa-camera upload-button"></i>
<input class="file-upload" type="file" accept="image/*"/>
</div>
</div>
</div>