Change file size in files array with JavaScript
2015-04-07, 04:59 AM,
#1
I am making simple picture uploading site and I am making it secure as possible. Now I am checking that the file size is below 1 MB with PHP. But I also added client side validation with JavaScript and here is my validation code:

Code:
$('#upload-form').on('submit', function(e) {
    if (document.getElementById('file').files[0].size > 1048576) {
        // prevent form submitting and show error message
    } else {
        // submit form
    }
});

My question is that can people modify document.getElementById('file').files[0].size value with browser's console? Because when I tried to modify it like this it didn't work.

Code:
document.getElementById('file').files[0].size = 10;

So is there any way someone can change that value with console or with something else?
Reply
2015-04-08, 12:14 AM,
#2
(2015-04-07, 04:59 AM)Heka Wrote: I am making simple picture uploading site and I am making it secure as possible. Now I am checking that the file size is below 1 MB with PHP. But I also added client side validation with JavaScript and here is my validation code:

Code:
$('#upload-form').on('submit', function(e) {
    if (document.getElementById('file').files[0].size > 1048576) {
        // prevent form submitting and show error message
    } else {
        // submit form
    }
});

My question is that can people modify document.getElementById('file').files[0].size value with browser's console? Because when I tried to modify it like this it didn't work.

Code:
document.getElementById('file').files[0].size = 10;

So is there any way someone can change that value with console or with something else?

Heka log on skype please : S been waiting you for ages !
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  help in file css vip2 1 827 2016-11-25, 12:36 AM
Last Post: torothemes
  [C++] Finding, reading and using CSV file in C++. Lukasz 4 1,117 2016-09-08, 10:35 AM
Last Post: styx
  [HELP] How to Change Cpagrip Url / File locker Favicon ? ashu55 2 1,270 2016-08-24, 06:35 PM
Last Post: ashu55
  CPAgrip File Locker Mobile Friendly Frezer 0 817 2016-08-17, 08:37 PM
Last Post: Frezer
  [SHARE} High Quality Javascript ALERTS! Mimo 0 1,016 2016-07-11, 05:13 PM
Last Post: Mimo




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top