2018-10-09 19:39:09 -05:00
|
|
|
<?php
|
2019-02-14 09:39:29 -06:00
|
|
|
include("../res/config.php");
|
|
|
|
include("../res/library/main.php");
|
2018-10-09 19:39:09 -05:00
|
|
|
|
|
|
|
$file_name = $_FILES["uploadcoin"]["name"];
|
|
|
|
$file_ext = file_extension($file_name);
|
|
|
|
if (!empty($_POST["desired_filename"])) {
|
|
|
|
$file_name = $_POST["desired_filename"];
|
|
|
|
if (!file_extension($file_name)) {
|
2018-10-09 19:42:44 -05:00
|
|
|
$file_name = $file_name . "." . $file_ext;
|
2018-10-09 19:39:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$file_name = sanitize_filename($file_name);
|
|
|
|
|
|
|
|
$dest_name = $GLOBALS["file_beam_dir"] . $file_name;
|
|
|
|
$dest_file = root("public_html/" . $dest_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (true) {
|
|
|
|
case (empty($file_name) || empty($dest_name)):
|
|
|
|
redirect(make_url("result/beam.php?error=1"));
|
|
|
|
break;
|
2019-01-26 23:55:01 -06:00
|
|
|
|
2018-10-09 19:39:09 -05:00
|
|
|
case (file_exists($dest_file)):
|
|
|
|
redirect(make_url("result/beam.php?error=2"));
|
|
|
|
break;
|
|
|
|
|
2019-01-26 23:55:01 -06:00
|
|
|
|
2018-10-09 19:39:09 -05:00
|
|
|
case (move_uploaded_file($_FILES["uploadcoin"]["tmp_name"], $dest_file)
|
|
|
|
&& write_metadata($dest_file, $_POST["file_source"])):
|
2019-01-26 23:55:01 -06:00
|
|
|
|
2019-01-27 01:51:11 -06:00
|
|
|
if (is_image($dest_file)) {
|
2019-01-26 23:55:01 -06:00
|
|
|
sanitize_image($dest_file);
|
|
|
|
}
|
|
|
|
|
2018-10-09 19:39:09 -05:00
|
|
|
redirect(make_url("result/beam.php?success="
|
|
|
|
. $file_name));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
redirect(make_url("result/beam.php"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|