-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexmple.php
49 lines (47 loc) · 2.19 KB
/
exmple.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html dir="rtl" lang="ar">
<head>
<title>upload class </title>
<meta charset='utf-8'/>
</head>
<body>
<?php
include_once 'upload.php';
?>
<?php
$up=new up();
$up->mime=array('image/png','image/x-png','image/pjpeg','image/jpg','image/jpeg','image/gif'); // mime types
$up->ext=array('png','jpg','jpeg','gif'); // extention allowed
$up->up_folder=('up'); // dir to upload
$up->upl=(__DIR__.'/'.$up->up_folder); // dont edit this
$up->file_name = 'img'; // name of file upload
$up->max_size="1024000"; // 1 Mb
if(!is_dir($up->upl)){
exit(" مجلد الرفع ".$up->upl." غير موجود");
}
if(!is_writable($up->upl)){
exit(" مجلد الرفع ".$up->upl." غير قابل للكتابة الرجاء إعطاءه التصريح 777");
}
if(isset($_POST['add']))
{
$isup=$up->upload();
if($isup === TRUE){
$img = $up->url;
$imag=$up->upl."/$img";
chmod($imag, 0644);
?>
<img src="<?php echo $up->up_folder.'/'.$img; ?>">
<?php
}else
{
echo $isup;
}
}
?>
<form method="post" action="" enctype="multipart/form-data">
<label>إختار الصورة من جهازك : </label>
<input type="file" name="img" >
<input type="submit" value="رفع" name="add">
</form>
</body>
</html>