查看: 121|回复: 1

红香蕉APP文件上传接口分析

[复制链接]

7

主题

10

帖子

24

积分

新手上路

Rank: 1

积分
24
发表于 2023-1-17 11:59:34 | 显示全部楼层 |阅读模式
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">        <head>                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">        </head>        <form enctype="multipart/form-data" method="post">            <p>请选择要上传的图片:<p>            <input class="input_file" type="file" name="upload_file"/>            <input class="button" type="submit" name="submit" value="上传"/>        </form></html><?php        //highlight_file(__FILE__);        //$key = '51d0a99c-752e-11ed-b5a7-44af28a75237';        if (isset($_POST['submit'])){                $file_name = trim($_FILES['upload_file']['name']);                $black = array(".php",".php5",".php4",".php3",".php2",".html",".htm",".phtml",".pht",".pHp",".pHp5",".pHp4",".pHp3",".pHp2",".Html",".Htm",".pHtml",".jsp",".jspa",".jspx",".jsw",".jsv",".jspf",".jtml",".jSp",".jSpx",".jSpa",".jSw",".jSv",".jSpf",".jHtml",".asp",".aspx",".asa",".asax",".ascx",".ashx",".asmx",".cer",".aSp",".aSpx",".aSa",".aSax",".aScx",".aShx",".aSmx",".cEr",".sWf",".swf",".htaccess",".ini");                $file_ext = strrchr($file_name, '.');                $file_ext = strtolower($file_ext);                //echo $file_ext;                if (!in_array($file_ext, $black)){                        $temp_file = $_FILES['upload_file']['tmp_name'];                        $img_path = 'upload'.'/'.date("His").rand(100,999).$file_ext;                        if (move_uploaded_file($temp_file, $img_path)) {                        $is_upload = true;                } else {                    $msg = '上传出错!';                }                }else {                $msg = 'This file type cannot be uploaded';            }        }    if($msg != null){        echo "提示:".$msg;    }        if($is_upload){        echo 'ok';    }?>
回复

使用道具 举报

0

主题

5

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2023-1-17 12:00:18 | 显示全部楼层
金盾信安杯啊[大哭]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表