/var/www/hkosl.com/littleark/webadmin/head.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Content Management System (CMS) - Powered by One Solution Limited</title>
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.11.4/jquery-ui.min.js"></script>
    <link type="text/css" href="js/jquery-ui-1.11.4/jquery-ui.css" rel="stylesheet"/>

    <script type="text/javascript">
        var total_file_size = 0;
        $(function () {
            $("input[type='file']").on("change", function () {
                console.log("Size: " + (this.files[0].size / (1024*1024)).toFixed(2) + " MB \n");
                total_file_size += this.files[0].size;
                if(this.files[0].size > (1024 * 1024 * 2)){
                    //txt = "Size: " + (this.files[0].size / (1024*1024)).toFixed(2) + " MB \n";
                    $(this).val("");
                    alert("File size should lower than 2 MB.");
                }

                console.log(total_file_size / (1024*1024).toFixed(2) + " MB \n");
                //if(total_file_size > (1024 * 1024 * 2))
            });
        });
    </script>