From ad4a96d229cf9f5c48d72462114a8cc2c5e30028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=90=BC?= <2910196733@qq.com> Date: Sun, 22 May 2022 05:45:19 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7\344\273\266\344\275\234\344\270\232.txt" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" diff --git "a/\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" "b/\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" new file mode 100644 index 0000000..536ca07 --- /dev/null +++ "b/\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" @@ -0,0 +1,43 @@ + + + + + 实现一个上传文件,仅限制pdf和word模式,大小不超过1m + + +
+请输入你要上传的文件: +
+ +
+ + + + + + +```php +SIZE){ + echo "上传文件太大了!"; + }else{ + echo "可以上传!"; + $array =array("pdf","word"); + $name=$_FILES["file1"]['name']; + $nameArr=explode(".",$name); + $lastname=$nameArr[count($nameArr)-1]; + $result=array_search($lastname,$array); + if ($result==false){ + echo "不允许上传的类型"; + + }else{ + echo "允许上传的类型"; + } + } + +} +``` \ No newline at end of file -- Gitee From 22bc163da228389445454024aadab3b87efda0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=90=BC?= <2910196733@qq.com> Date: Sun, 22 May 2022 05:45:46 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E6=96=B9?= =?UTF-8?q?=E7=90=BC/20220522-php=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A.txt=20=E4=B8=BA=20=E6=96=B9=E7=90=BC/2022052?= =?UTF-8?q?2-php=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E4=BD=9C=E4=B8=9A.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...44\274\240\346\226\207\344\273\266\344\275\234\344\270\232.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" => "\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.md" (100%) diff --git "a/\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" "b/\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.md" similarity index 100% rename from "\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.txt" rename to "\346\226\271\347\220\274/20220522-php\344\270\212\344\274\240\346\226\207\344\273\266\344\275\234\344\270\232.md" -- Gitee