服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|

服务器之家 - 编程语言 - PHP教程 - PHP swfupload图片上传的实例代码

PHP swfupload图片上传的实例代码

2020-05-21 12:26PHP教程网 PHP教程

swfupload已经是第二次研究,这次自已整了个简单demo,有需要的朋友可以参考一下

PHP代码如下:

 

复制代码 代码如下:

if (isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {
    $upload_file = $_FILES['Filedata'];
    $file_info   = pathinfo($upload_file['name']);
    $file_type   = $file_info['extension'];
    $save        = 'image/' . md5(uniqid($_FILES["Filedata"]['name'])) . '.' . $file_info['extension'];
    $name        = $_FILES['Filedata']['tmp_name'];

    if (!move_uploaded_file($name, $save)) {
        exit;
    }

    //将数组的输出存起来以供查看
    $fileName = 'test.txt';
    $postData = var_export($file_info, true);
    $file     = fopen('' . $fileName, "w");
    fwrite($file,$postData);
    fclose($file);
}

 

例包下载

延伸 · 阅读

精彩推荐