diff --git a/lua/entities/gmod_wire_expression2/core/files.lua b/lua/entities/gmod_wire_expression2/core/files.lua index 9447eff05d..9b3526d7ec 100644 --- a/lua/entities/gmod_wire_expression2/core/files.lua +++ b/lua/entities/gmod_wire_expression2/core/files.lua @@ -414,13 +414,17 @@ net.Receive("wire_expression2_file_upload", function(_, ply) if pfile then if net.ReadBool() and not pfile.uploading and not pfile.uploaded then local len = net.ReadUInt(32) - if len / 1024 > cv_max_transfer_size:GetInt() then + if len > cv_max_transfer_size:GetInt() * 1024 then pfile.uploading = false pfile.uploaded = false file_execute(ply, pfile, FILE_TRANSFER_ERROR) else pfile.uploading = true pfile.Stream = net.ReadStream(ply, function(data) + if not data or #data > cv_max_transfer_size:GetInt() * 1024 then + return file_execute(ply, pfile, FILE_TRANSFER_ERROR) + end + pfile.data = data pfile.uploading = false pfile.uploaded = true @@ -489,4 +493,4 @@ E2Lib.registerEvent("fileWritten", { E2Lib.registerEvent("fileList", { { "Path", "s"}, { "Contents", "r" } -}) \ No newline at end of file +})