CSRF error while uploadinga file bigger than 5-6 MB - SubrataJ - 12-09-2022
Hi everyone, while uploading a file size of more than 5 or 6 MB, I am getting a CSRF error, Kindly let me know whether it's an issue or if I am doing anything wrong.
Error - Video to make it more clear.
RE: CSRF error while uploadinga file bigger than 5-6 MB - InsiteFX - 12-10-2022
Your video is cutting off the error message, please fix or post the ERROR your getting here so that
we can help you.
RE: CSRF error while uploadinga file bigger than 5-6 MB - SubrataJ - 12-10-2022
(12-10-2022, 12:29 AM)InsiteFX Wrote: Your video is cutting off the error message, please fix or post the ERROR your getting here so that
we can help you.
Code: {
"title": "CodeIgniter\\Security\\Exceptions\\SecurityException",
"type": "CodeIgniter\\Security\\Exceptions\\SecurityException",
"code": 403,
"message": "The action you requested is not allowed.",
"file": "/home/sdocmanager/public_html/vendor/codeigniter4/framework/system/Security/Security.php",
"line": 306,
"trace": [
{
"file": "/home/sdocmanager/public_html/vendor/codeigniter4/framework/system/Security/Security.php",
"line": 306,
"function": "forDisallowedAction",
"class": "CodeIgniter\\Security\\Exceptions\\SecurityException",
"type": "::",
"args": []
},
{
"file": "/home/sdocmanager/public_html/vendor/codeigniter4/framework/system/Filters/CSRF.php",
"line": 55,
"function": "verify",
"class": "CodeIgniter\\Security\\Security",
"type": "->",
"args": [
{
"uri": {},
"config": {
"baseURL": "http://sdocmanager.com/",
"indexPage": "",
"uriProtocol": "REQUEST_URI",
"defaultLocale": "en",
"negotiateLocale": false,
"supportedLocales": [
"en",
"es"
],
"appTimezone": "Asia/Kolkata",
"charset": "UTF-8",
"forceGlobalSecureRequests": true,
"sessionDriver": "CodeIgniter\\Session\\Handlers\\FileHandler",
"sessionCookieName": "ci_session",
"sessionExpiration": 7200,
"sessionSavePath": "/home/sdocmanager/public_html/writable/session",
"sessionMatchIP": false,
"sessionTimeToUpdate": 300,
"sessionRegenerateDestroy": false,
"cookiePrefix": "",
"cookieDomain": "",
"cookiePath": "/",
"cookieSecure": false,
"cookieHTTPOnly": true,
"cookieSameSite": "Lax",
"proxyIPs": "",
"CSRFTokenName": "csrf_test_name",
"CSRFHeaderName": "X-CSRF-TOKEN",
"CSRFCookieName": "csrf_cookie_name",
"CSRFExpire": 7200,
"CSRFRegenerate": true,
"CSRFRedirect": true,
"CSRFSameSite": "Lax",
"CSPEnabled": false
}
}
]
},
{
"file": "/home/sdocmanager/public_html/vendor/codeigniter4/framework/system/Filters/Filters.php",
"line": 173,
"function": "before",
"class": "CodeIgniter\\Filters\\CSRF",
"type": "->",
"args": [
{
"uri": {},
"config": {
"baseURL": "http://sdocmanager.com/",
"indexPage": "",
"uriProtocol": "REQUEST_URI",
"defaultLocale": "en",
"negotiateLocale": false,
"supportedLocales": [
"en",
"es"
],
"appTimezone": "Asia/Kolkata",
"charset": "UTF-8",
"forceGlobalSecureRequests": true,
"sessionDriver": "CodeIgniter\\Session\\Handlers\\FileHandler",
"sessionCookieName": "ci_session",
"sessionExpiration": 7200,
"sessionSavePath": "/home/sdocmanager/public_html/writable/session",
"sessionMatchIP": false,
"sessionTimeToUpdate": 300,
"sessionRegenerateDestroy": false,
"cookiePrefix": "",
"cookieDomain": "",
"cookiePath": "/",
"cookieSecure": false,
"cookieHTTPOnly": true,
"cookieSameSite": "Lax",
"proxyIPs": "",
"CSRFTokenName": "csrf_test_name",
"CSRFHeaderName": "X-CSRF-TOKEN",
"CSRFCookieName": "csrf_cookie_name",
"CSRFExpire": 7200,
"CSRFRegenerate": true,
"CSRFRedirect": true,
"CSRFSameSite": "Lax",
"CSPEnabled": false
}
},
null
]
},
{
"file": "/home/sdocmanager/public_html/vendor/codeigniter4/framework/system/CodeIgniter.php",
"line": 455,
"function": "run",
"class": "CodeIgniter\\Filters\\Filters",
"type": "->",
"args": [
"service-providers/attempt-to-upload-file",
"before"
]
},
{
"file": "/home/sdocmanager/public_html/vendor/codeigniter4/framework/system/CodeIgniter.php",
"line": 351,
"function": "handleRequest",
"class": "CodeIgniter\\CodeIgniter",
"type": "->",
"args": [
null,
{
"handler": "file",
"backupHandler": "dummy",
"storePath": "/home/sdocmanager/public_html/writable/cache/",
"cacheQueryString": false,
"prefix": "",
"ttl": 60,
"reservedCharacters": "{}()/\\@:",
"file": {
"storePath": "/home/sdocmanager/public_html/writable/cache/",
"mode": 416
},
"memcached": {
"host": "127.0.0.1",
"port": 11211,
"weight": 1,
"raw": false
},
"redis": {
"host": "127.0.0.1",
"password": null,
"port": 6379,
"timeout": 0,
"database": 0
},
"validHandlers": {
"dummy": "CodeIgniter\\Cache\\Handlers\\DummyHandler",
"file": "CodeIgniter\\Cache\\Handlers\\FileHandler",
"memcached": "CodeIgniter\\Cache\\Handlers\\MemcachedHandler",
"predis": "CodeIgniter\\Cache\\Handlers\\PredisHandler",
"redis": "CodeIgniter\\Cache\\Handlers\\RedisHandler",
"wincache": "CodeIgniter\\Cache\\Handlers\\WincacheHandler"
}
},
false
]
},
{
"file": "/home/sdocmanager/public_html/public/index.php",
"line": 67,
"function": "run",
"class": "CodeIgniter\\CodeIgniter",
"type": "->",
"args": []
}
]
}
For small file sizes, there's no issue, but for big files, after a few sec, it's showing a token error.
(12-10-2022, 12:29 AM)InsiteFX Wrote: Your video is cutting off the error message, please fix or post the ERROR your getting here so that
we can help you.
here's another video link where you can see there's no problem while uploading a small file -> Error File
RE: CSRF error while uploadinga file bigger than 5-6 MB - kenjis - 12-11-2022
Try to upload files with the opposite order, a big file and a small file.
RE: CSRF error while uploadinga file bigger than 5-6 MB - SubrataJ - 12-12-2022
(12-11-2022, 01:32 AM)kenjis Wrote: Try to upload files with the opposite order, a big file and a small file.
I have checked the same as per your instruction, but I am facing the same issue, here is the link Demo
RE: CSRF error while uploadinga file bigger than 5-6 MB - kenjis - 12-12-2022
Now you know the file size does not matter.
RE: CSRF error while uploadinga file bigger than 5-6 MB - SubrataJ - 12-12-2022
(12-12-2022, 12:52 AM)kenjis Wrote: Now you know the file size does not matter.
I didn't get it , but if you are saying file size doesn't matter then why it's throwing token error for big files only, if I upload small files no error is showing up. If you want me to post code that being used for file upload , I can do that as well.
RE: CSRF error while uploadinga file bigger than 5-6 MB - [email protected] - 12-12-2022
(12-12-2022, 02:15 AM)SubrataJ Wrote: (12-12-2022, 12:52 AM)kenjis Wrote: Now you know the file size does not matter.
I didn't get it , but if you are saying file size doesn't matter then why it's throwing token error for big files only, if I upload small files no error is showing up. If you want me to post code that being used for file upload , I can do that as well.
Have u check upload allowed size on php.ini ?
Or if u can't change it try adding this on .htaccess
Code: php_value post_max_size 64M
php_value upload_max_filesize 32M
RE: CSRF error while uploadinga file bigger than 5-6 MB - kenjis - 12-12-2022
Sorry, I misunderstood your comment.
RE: CSRF error while uploadinga file bigger than 5-6 MB - SubrataJ - 12-12-2022
I want to apologize to everyone as I acted so foolishly and post this here, I just checked upload_max_filesize and it was only 5M, Thank you @[email protected] for giving me the hint.
|