By GokiSoft.com| 09:57 13/04/2022|
Học PHP

[Source Code] Huong dan day file len Server - C2108G3



<?php
// var_dump($_POST);
// var_dump($_FILES);
$pathFile = '';

if(!empty($_FILES)) {
	$fname = $_FILES['filename']['name'];
	$path = $_FILES['filename']['tmp_name'];

	move_uploaded_file($path, 'photos/'.$fname);

	$pathFile = 'photos/'.$fname;
	// $pathFile -> thumbnail trong bang product/news/user
	// Limit dung luon file day len
	// Check extension file -> jpg, png, bmp, webp, jpeg, ...
	// Check trung file -> Xu ly nhu the nao
	// remove special character (a-z-0-9)
}
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Day File Len Server</title>
</head>
<body>
	<img src="<?=$pathFile?>" style="width: 600px;">
<form method="post" enctype="multipart/form-data">
	<input type="file" name="filename">
	<button>Submit</button>
</form>
</body>
</html>




Tags:



Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)

Đăng nhập để làm bài kiểm tra

Chưa có kết quả nào trước đó