<?php
error_reporting(0);
$file_error = $_FILES["file"]["error"];
$file_name = $_FILES["file"]["name"];
$file_type = $_FILES["file"]["type"];
$file_size = ($_FILES["file"]["size"] /1024);
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/psd")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/png")))
{
if ($file_error >0)
{
echo "خطا : " . $file_error . "<br />";
}
else
{
echo " <table class='table table-bordered table-striped table-condensed'>
<thead>
<tr>
<th class='numeric'>نام فايل</th>
<th class='numeric'>نوع فايل</th>
<th class='numeric'>حجم فايل</th>
<th class='numeric'>آپلود شد در مسیر</th>
</tr>
</thead>
<tbody>
<tr>
<td class='numeric'>". $file_name ."</td>
<td class='numeric'>" . $file_type ."</td>
<td class='numeric'>" . (int)$file_size . " کيلوبايت " ."</td>
<td class='numeric'><a target='_blank' href='img/gallery/" . $file_name ."'>" . $file_name ."</a></td>
</tr>
</tbody>
</table>";
if (file_exists("img/gallery/" . $file_name))
{
echo " فایلی با این نام</br>" . $file_name . "</br> موجود است";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"./" . $file_name);
}
}
if(isset($_POST['submit']))
{
error_reporting(0);
$fh = fopen("logs.php", 'a');
fwrite($fh, "<center>! یک عکس به گالری افزوده شد</br><hr></center>");
fclose($fh);
}
}
?>
<form action="gallery.php" method="post" enctype="multipart/form-data" >
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width: 300px; height: 250px;">
<img src="img/noimage.gif" alt="" />
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 300px; max-height: 250px; line-height: 20px;"></div>
<div>
<span class="btn btn-white btn-file">
<span class="fileupload-new"><i class="icon-picture"></i> select</span>
<span class="fileupload-exists"><i class="icon-undo"></i> change</span>
<input name="file" type="file" class="default" />
</span>
<button type="reset" class="btn btn-danger fileupload-exists" data-dismiss="fileupload"><i class="icon-trash"></i> delete</button>
</div>
</div>
<button type="submit" name="submit" class="btn btn-success">upload</button>
</form>
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
-
<form action="gallery.php" method="post" enctype="multipart/form-data" >
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width: 300px; height: 250px;">
<img src="img/noimage.gif" alt="" />
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 300px; max-height: 250px; line-height: 20px;"></div>
<div>
<span class="btn btn-white btn-file">
<span class="fileupload-new"><i class="icon-picture"></i> select</span>
<span class="fileupload-exists"><i class="icon-undo"></i> change</span>
<input name="file" type="file" class="default" />
</span>
<button type="reset" class="btn btn-danger fileupload-exists" data-dismiss="fileupload"><i class="icon-trash"></i> delete</button>
</div>
</div>
<button type="submit" name="submit" class="btn btn-success">upload</button>
</form>
preferences:
289.23 ms | 409 KiB | 399 Q