mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
Handle & show upload_max_filesize occurences (#1241)
This commit is contained in:
parent
e9fec26e7d
commit
0525597a15
4 changed files with 19 additions and 6 deletions
|
@ -30,7 +30,7 @@ if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
||||||
} catch (Exception) {
|
} catch (\Exception) {
|
||||||
$this->response['html'] = $lang['TORFILE_INVALID'];
|
$this->response['html'] = $lang['TORFILE_INVALID'];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ if ($bb_cfg['flist_max_files']) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$torrent = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
$torrent = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
||||||
} catch (Exception) {
|
} catch (\Exception) {
|
||||||
http_response_code(410);
|
http_response_code(410);
|
||||||
die($lang['TORFILE_INVALID']);
|
die($lang['TORFILE_INVALID']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -734,7 +734,20 @@ class Attach
|
||||||
$file = $_FILES['fileupload']['tmp_name'];
|
$file = $_FILES['fileupload']['tmp_name'];
|
||||||
$this->type = $_FILES['fileupload']['type'];
|
$this->type = $_FILES['fileupload']['type'];
|
||||||
|
|
||||||
if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] == 0) {
|
if (isset($_FILES['fileupload']['error'])) {
|
||||||
|
switch($_FILES['fileupload']['error']) {
|
||||||
|
case UPLOAD_ERR_NO_FILE:
|
||||||
|
bb_die('No file content sent');
|
||||||
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
|
bb_die('upload_max_filesize setting: ' . ini_get('upload_max_filesize'));
|
||||||
|
case UPLOAD_ERR_CANT_WRITE:
|
||||||
|
bb_die('Failed to write file to disk, check permissions');
|
||||||
|
case UPLOAD_ERR_PARTIAL:
|
||||||
|
bb_die('The uploaded file was only partially uploaded');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] === 0) {
|
||||||
bb_die('Tried to upload empty file');
|
bb_die('Tried to upload empty file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ class Torrent
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
||||||
} catch (Exception) {
|
} catch (\Exception $e) {
|
||||||
self::torrent_error_exit($lang['TORFILE_INVALID']);
|
self::torrent_error_exit($lang['TORFILE_INVALID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ class Torrent
|
||||||
$file_contents = file_get_contents($filename);
|
$file_contents = file_get_contents($filename);
|
||||||
try {
|
try {
|
||||||
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY);
|
||||||
} catch (Exception) {
|
} catch (\Exception) {
|
||||||
bb_die($lang['TORFILE_INVALID']);
|
bb_die($lang['TORFILE_INVALID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue