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GUsS8J18iojdvzS7mn/nFwUbDXZIyvtrK+FbMb9+5S1sxGGPP5fNSbz6v3uWWeAteOGAvrE0smysW89qYN2zO0JvXFAY0N2ALl6j12aHLfaVufM9dLRPXjOQDn0XMmzbU47+a71HM+42W90GqRsyvoXQx7/kflOb7yAeTzC7mDzzzTBjzS2HABzG/bceO1Ctb45Fwq80xSo811fEwO1Lzz8K0seC/FgysEPPIELuYLx44sNxoxPz3823bU6+MmAdaSHkAvWIX8/uLT+/bv39o3/DeoX279+wd3L1n1+Dgzl2F7Tt3bdux4+fbtv/sqW2pV0bMAwDQW3YxDwAAHiDEPAAAmUXMAwCQWcQ8AACZRcwDAJBZxDwAAJlFzAMAkFnEPAAAmUXMAwCQWcQ8AACZRcwDAJBZxDwAAJlFzAMAkFnEPAAAmUXMAwCQWcQ8AACZRcwDAJBZxDwAAJlFzAMAkFnEPAAAmUXMAwCQWcQ8AACZRcwDAJBZxDwAAJlFzAMAkFnEPAAAmUXMAwCQWcQ8AACZRcwDAJBZxDwAAJlFzAMAkFn/B6mUVwGR61iZAAAAAElFTkSuQmCC" alt="" />
upload文件夹是用来暂时存放上传的文件,方便读取和写等操作,upload.html是前端上传文件页面,upload.php是处理页面
upload.html
<html>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<label>选择文件</label>
<input type="file" id="file" name="file" />
<button type="submit" class="btn btn-primary">提交</button>
</form>
</html>
upload.php
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
$fileName = $_FILES["file"]["name"];
$type = $_FILES["file"]["type"];
$size = ($_FILES["file"]["size"] / 1024)." kb" ;
$tmp_name = $_FILES["file"]["tmp_name"] ;
echo "Upload: " .$fileName . "<br />";
echo "Type: " . $tyep . "<br />";
echo "Size: " . $size. " Kb<br />";
echo "Stored in: " . $tmp_name."<br />";
move_uploaded_file($tmp_name,"upload/" .$fileName);
echo "success";
}
?>
结果如下:
上传文件
aaarticlea/png;base64,iVBORw0K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S/huOLPK21k1keZItLZVzsc5odGFuDtNycbtuTbnYIW/8cavVKEgZaiidc3mcy1QVkGJuzqVn+spz1zVnrDusJJc2VrAD2I7m1NaWaOmIDLsIy2Wg+NhStN+7l8rGqNtGLkGPfCtyqb1JF3JZj/kJXROdTE7N+/OzljSld+j28chw8DqznsAmulQKOLgQZNM5UcOI51z6brlUqqiq+LTI62Y9UEqXEf7755f69efvv3+xwylyci7doDdOGWRXwtmZttCNTlwneUGQfwBrMFMu5haYuK2ZCdQu5NILZTIFMmJu5BJePXoO8zfJlpaRy6jL/ChyIJf2XtA9zevYTkaicgmuFjlldV17ohkUelOfvlZZDuZDStU3cxbDrMEsuZjU4PgG51+lygvIsxUjt8/F3zU3jbtrNksu3lL1BIMwRlQunSMaXahgQuXiZ9Gcvhzvu3t5asT2/88kdxNddXHvfKELcGrfVX8Nb7SJbi6RUMOce+G70guRlEsrj8Dkx3Tdontwp0Eun8kHfXHxJ8G3omH/IJe3BLnA/kEubwlygf2DXN4S5AL7Z/O/9T/+WfgXXLa5nSDxXwuJsvUHBhuwuUqQCwC8JcgFAERALgAgAnIBABGQCwCIgFwAQATkAgAiIBcAEAG5AIAIyAUAREAuACACcgEAEZALAIiAXABABOQCACIgFwAQAbkAgAjIBQBEQC4AIAJyAQARkAsAiPA/yMiXsnv14nkAAAAASUVORK5CYII=" alt="" />
结果
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAa4AAACFCAIAAACMi4uMAAAOAUlEQVR4nO2dzaocxxXH6zHyCMmq30EY5x0EDVl5o4XAYKMr0CpCeOQYLWLIJU6EtNHmLu5w0X2MbMJAwAQSEowJDiZvUFnM9EzVqXOqqj9n5s7vt5vp+uiq7vr3qa9T7n8///jzf3/46T///vGHf/zrn9///fvN5q9/+cVv/+YBAC4GhxQCACCFAABIIQAAUggA4JFCAACPFAIAeKQQAMAjhQAAHikEAPBIIQCAP5YUblaNc81qc6R0161zrl0fKXcAOD2GSOFm1WhKsm6rheDipLC+bnrU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ZqxAALg53ddVJ4XdfvXjzng4yAFwg7ub6JVIIABeOe3kVdpBffYsUAsDl4b755uWzZ8++fnt3e3t7c/3qKdMmAHB5sJgGAAApBABACgEAPFIIAOCRQgAAjxQCAHikEADAI4UAAB4pBADwSCEAgEcKAQC89+49UggAFw9SCABABxkAwPv/A2y6XaO+Z5whAAAAAElFTkSuQmCC" alt="" />
-----------------------------------------------------------------------------
2.下面对上传的文件进行读操作
1)逐行读
function readData($name){
if($name=='')return '';
$file = fopen(upload.'/'.$name, "r");
$data=array();
$i=0;
//输出文本中所有的行,直到文件结束为止。
while(! feof($file))
{
$data[$i]= fgets($file);//fgets()函数从文件指针中读取一行
$i++;
}
fclose($file);
$data=array_filter($data);
return $data;
}
$name = 'load.txt';
$data = readData($name);
print_r($data);
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGYAAAAsCAIAAACopym9AAAQo0lEQVR4nO2d2aGrMAxE0xEVURDdUEz6yfsIYC0j2SYkwLtz/gLGqyxrzJLHixBCCCGEEEJIwOPsChBCCCGEEELIdaFkIoQQQgghhJAQSiZCCCGEEEIICaFkIoQQQgghhJAQSqZr8pyGx+PxeDzG+eyq/A3msdrZHJP70DCchPynPKfh8Rim59n1uBzsmAM5uTM5lgfATuwmlUzz+Di/P+cxqMM8Ph4mhN2CWlnvcvBaIRSs7BsX8CVpv1CbpJhwNO5ONcZuDsKLXbr02TC2DjEw+5KBOHRVs3cVrZB0Z+2qenKZeVzCcxqu14sXJ+9ZcXbvPCjp1lSqyHLpdvhKfku2stOy5hH3mZ37lUXzTxr8oRGiXjLD7nJRVONS+0K+Hs+Oc3y978x9vlpm13F141j+9cAmp2tCtBn8OxU6W134vU8vqGl0pk9PJNMlNtXnMSzfnlKj70KmJKMzUHZl7dauWPNoAoBjDeVdF5MnPPgfb0rUYuzGKEJmYzorG/LUHHwJth6bB3EVvJjZxxVN0odzunZhmvZdFZMEHuQtq36S6aLN2/Rtu6t7ToM6qZSEW7Zt6lNRbe5wqdu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vtaEYVxspMAzeDIMlOqSlrtRIkgvJyqSCbbL3BpzMiS4jWZr2aaYjiguKvR9ZBwrLZZ9umglfLPKNCQWPVZO4RS8zUQIIYQQQm5K5/8yhR8ByO4k6Psl5lE88KwdvE5LJnPvSEqmUDFACSLS7NQwkbL5UnFB4pfTpjgHJ5nSD2asd5MabiMl95EomQghhBBCyI3p/StbHYVvwXD+7JUJ3dfEKpRuucuEvi0hrzOx+W/uMnU8l/f1u0zmdlClT72UUdkuOX7+gURKJkIIIYQQcmM+usu0RcP6swuv5zO+W7SW8P5WXPbqjnniq6gy/WW8YVh/mVq0vsukXsDaoWE632X6tDiYePvtP/6Q9KkTuuLq7FUqM761u0x8l4kQQgghhNyYimR6TkP89eolwaOIlnIw+k5cOTYMA4jX9fN77psD9vty2y0u9LoN/jxfeBemR8Ooutq3edYv5h1XnAN8MW9AheqH9Vyf6h6SjcpvHMn/Nw7egNJ15U0mQgghhBByV+p3meTX70DkG7z9L6+K7sCEXxpYrsq+SN7GJq1wc/KbUs2SKWvvMcXhhgWf3sMfFl/K9zePcM3tH1vZFsjzuR6iYiKEEEIIIbcmkEyXiHHRs2HvAB9804BPfjXRrTqPKPAS1kQIIYQQQsguvGT6eVAdEr5OY2+BMCRv5eeDy/eYCCGEEELIzXGSqfIq/y9J/8yVtDCP7vsXP+zQC9kSIYQQQgghOymSKfqIwnlQMh2AviN3mbElhBBCCCHkJvwDlk/UcfVDJMkAAAAASUVORK5CYII=" alt="" />
2)一次性读完,返回到一个string,这个string的分隔符是\r\n
$alldata = file_get_contents('upload'.'/'.$name);
$onedata = explode("\r\n",$alldata);
print_r($alldata);
echo "<br/>";
print_r($onedata);
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGYAAABGCAIAAAAByAWBAAActUlEQVR4nO2d18GrMAyF2YiJGIhtGCb75D6EonIk27SQ+5/vLWBcZFnFlHRvQgghhBBCCCEB3bc7QAghhBBCCCHP5YSUaRq6ruu6rh9fxysjRaah67phyoq8xv4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KAjFHdES332gghhBBCyJ8nfzAPPfG1FAyDXZMKvIInw0Crruh2N0qEuNuJQsoEx2Vujbk0pHyDJLrjclFzUaOfI8NQGLGU6Zxc4JtVZiBxAmLTKXB1dKn/aseJd3y2JzdL9fE2EyGEEEIIqaf0v0zhRwCysFPfLzGP4oFn7eB1OmUy945kyhRmDDAFEWV25jBRZnNRc0Hhd5SAJDItPri43k0q3ITJNCbPR9LX1U4Bf0yxoYuEEEIIIYRIin9lq6PwNefJo04Tui+F1T2hmrtM6NsS8jpz/+meu0wNz+VdfpfJ3FUpyNQ/kaaqnWusSCayV5sK+UigGmHZ8oN5sk+8y0QIIYQQQs6m7S7TGnWbd+5fr/hu0fu9xKj6lpB/dcc88bUFtvrLeH2//LJv/le+y6RewNqRwzS+y3S0OVh4/e0//pDI1OUK4ursVSozvy13mQqqcUL2wneZCCGEEELIldiU6TX2Nufw9yW2pGU7aG51mJB0Grqu73sQr+vn9zp4S0vcQlhvcaEYGX+eL7wL05LDqL7at3mWL+ad15wDfDGvR43qx9KcTLWE5KBKf58U/8utK2pHmanG8ZTJ5s1VV/AmEyGEEEIIqQXcZZKPQ4FgNHj7X14V3YEJvzQwX5V9kbyONbXCw8lvSlWnTNl4z2kOD2wubPuCPyw+t+9vHuGem2/iuRHI82mK4hOSTDW+kL4wYyKEEEIIIS0sKdMjHlRCz4Z94m3wTQNGvVU0Z51HactI7s9fmDERQgghhJAmui8E1SHh6zT2FsgjEryf4P7JfXbKxPeYCCGEEEJII13+vbx7Sf/MldQwDe77FzcLtPZrDA1fuDsL6hchhBBCCGnn1pC1BEPaE9B35B4zt4QQQgghhPwm3bc7QAghhBBCCCHPhSkTIYQQQgghhIQwZSKEEEIIIYSQEKZMhBBCCCGEEBLClIkQQgghhBBCQpgyEUIIIYQQQkgIUyZCCCGEEEIICfkHh49CNBlWzGcAAAAASUVORK5CYII=" alt="" />
---------------------------------------------------------------------
3.删除一个文件夹下面的所有文件
public static function delFile($dirName){
if(file_exists($dirName) && $handle=opendir($dirName)){
while(false!==($item = readdir($handle))){
if($item!= "." && $item != ".."){
if(file_exists($dirName.'/'.$item) && is_dir($dirName.'/'.$item)){
delFile($dirName.'/'.$item);
}else{
if(unlink($dirName.'/'.$item)){
return true;
}
}
}
}
closedir( $handle);
}
}
4.删除指定文件
<?php
$file = "upload/load.txt";
if (!unlink($file))
{
echo ("Error deleting $file");
}
else
{
echo ("Deleted $file");
}
?>