mirror of
https://github.com/anatolykopyl/file-directory.git
synced 2026-03-26 12:54:30 +00:00
25 lines
820 B
PHP
25 lines
820 B
PHP
<?php
|
|
if (($_FILES['file']['name'] != "")) {
|
|
// changing the upload limits
|
|
ini_set('upload_max_filesize', '4G');
|
|
ini_set('post_max_size', '4G');
|
|
ini_set('max_input_time', 1000);
|
|
ini_set('max_execution_time', 1000);
|
|
// Where the file is going to be stored
|
|
$target_dir = "files/";
|
|
$file = $_FILES['file']['name'];
|
|
$path = pathinfo($file);
|
|
$filename = $path['filename'];
|
|
$ext = $path['extension'];
|
|
$temp_name = $_FILES['file']['tmp_name'];
|
|
$path_filename_ext = $target_dir . $filename . "." . $ext;
|
|
|
|
// Check if file already exists
|
|
if (file_exists($path_filename_ext)) {
|
|
echo "Sorry, file already exists.";
|
|
} else {
|
|
move_uploaded_file($temp_name, $path_filename_ext);
|
|
echo "Congratulations! File Uploaded Successfully.";
|
|
}
|
|
}
|
|
?>
|