PHP swfupload图片上传的实例代码_php实例
程序员文章站
2024-01-31 14:56:46
...
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);
}
复制代码 代码如下:
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);
}
例包下载
下一篇: 何位大咖知道这段代码是做什么的