Add exams from exam58 to exam98
This commit is contained in:
46
exam86/upload.php
Executable file
46
exam86/upload.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
$name = $_FILES['file']['name'];
|
||||
|
||||
$strpos = strpos($name, '.');
|
||||
$extension = strtolower(substr($name, $strpos + 1));
|
||||
$type = $_FILES['file']['type'];
|
||||
|
||||
$size = $_FILES['file']['size'];
|
||||
$max_size = 2097152;
|
||||
|
||||
|
||||
$tmp_name = $_FILES['file']['tmp_name'];
|
||||
|
||||
|
||||
|
||||
if(isset($name)){
|
||||
if(!empty($name)){
|
||||
if($size <= $max_size){
|
||||
if(($extension == 'jpeg' || $extension =='jpg') && $type == 'image/jpeg' ){
|
||||
|
||||
$location = 'uploads/';
|
||||
|
||||
if(move_uploaded_file($tmp_name,$location . $name)){
|
||||
echo 'Uploaded';
|
||||
} else {
|
||||
echo 'There was some error!';
|
||||
}
|
||||
}else {
|
||||
echo 'File must be jpeg or jpg';
|
||||
}
|
||||
} else {
|
||||
echo 'File must be under 2mb';
|
||||
}
|
||||
} else {
|
||||
echo 'Choose some file!';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<form action="upload.php" method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="file"><br><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
BIN
exam86/uploads/Screenshot from 2024-04-29 12-34-05.png
Normal file
BIN
exam86/uploads/Screenshot from 2024-04-29 12-34-05.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
BIN
exam86/uploads/Untitled.jpeg
Normal file
BIN
exam86/uploads/Untitled.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Reference in New Issue
Block a user