PHP swfupload图片上传的实例代码
程序员文章站
2022-07-17 22:17:50
php代码如下:
复制代码 代码如下:if (isset($_files["filedata"]) || !is_uploaded_file($_files["filed...
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);
}