Home >Backend Development >PHP Tutorial >PHP swfupload image upload example code_PHP tutorial

PHP swfupload image upload example code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:13:111060browse

The PHP code is as follows:

Copy code The code is as follows:

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;
}

//Save the output of the array for viewing
$fileName = 'test.txt';
$postData = var_export($file_info, true);
$file = fopen('' . $fileName, "w");
fwrite($file,$postData);
fclose($file);
}

Example package download

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313521.htmlTechArticleThe PHP code is as follows: Copy the code as follows: if (isset($_FILES["Filedata"]) || ! is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) { $upload_f...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn