diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm
index 27e9c6fae74..466ebb53dd8 100644
--- a/code/controllers/configuration/entries/general.dm
+++ b/code/controllers/configuration/entries/general.dm
@@ -701,3 +701,11 @@
/datum/config_entry/flag/config_errors_runtime
default = FALSE
+
+/datum/config_entry/number/upload_limit
+ default = 524288
+ min_val = 0
+
+/datum/config_entry/number/upload_limit_admin
+ default = 5242880
+ min_val = 0
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 32763f6e81d..58dca3d9b22 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -1,8 +1,6 @@
////////////
//SECURITY//
////////////
-#define UPLOAD_LIMIT 524288 //Restricts client uploads to the server to 0.5MB
-#define UPLOAD_LIMIT_ADMIN 2621440 //Restricts admin client uploads to the server to 2.5MB
GLOBAL_LIST_INIT(blacklisted_builds, list(
"1407" = "bug preventing client display overrides from working leads to clients being able to see things/mobs they shouldn't be able to see",
@@ -203,12 +201,14 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc.
/client/AllowUpload(filename, filelength)
+ var/client_max_file_size = CONFIG_GET(number/upload_limit)
if (holder)
- if(filelength > UPLOAD_LIMIT_ADMIN)
- to_chat(src, "Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT_ADMIN/1024]KiB.")
+ var/admin_max_file_size = CONFIG_GET(number/upload_limit_admin)
+ if(filelength > admin_max_file_size)
+ to_chat(src, span_warning("Error: AllowUpload(): File Upload too large. Upload Limit: [admin_max_file_size/1024]KiB."))
return FALSE
- else if(filelength > UPLOAD_LIMIT)
- to_chat(src, "Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT/1024]KiB.")
+ else if(filelength > client_max_file_size)
+ to_chat(src, span_warning("Error: AllowUpload(): File Upload too large. Upload Limit: [client_max_file_size/1024]KiB."))
return FALSE
return TRUE
@@ -911,8 +911,6 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
add_verb(src, /client/proc/export_preferences)
-#undef UPLOAD_LIMIT
-
//checks if a client is afk
//3000 frames = 5 minutes
/client/proc/is_afk(duration = CONFIG_GET(number/inactivity_period))
@@ -1238,4 +1236,3 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
#undef LIMITER_SIZE
#undef MINUTE_COUNT
#undef SECOND_COUNT
-#undef UPLOAD_LIMIT_ADMIN
diff --git a/config/config.txt b/config/config.txt
index 56da612c51f..e262bc25706 100644
--- a/config/config.txt
+++ b/config/config.txt
@@ -584,3 +584,9 @@ TOAST_NOTIFICATION_ON_INIT
## Causes configuration errors to spit out runtimes
CONFIG_ERRORS_RUNTIME
+
+## Restricts client uploads to the server, defined in bytes, default is 0.5MB
+UPLOAD_LIMIT 524288
+
+## Restricts admin client uploads to the server, defined in bytes, default is 5MB
+UPLOAD_LIMIT_ADMIN 5242880