3v4l.org

run code in 300+ PHP versions simultaneously
<?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>

preferences:
42.5 ms | 402 KiB | 5 Q