[{"data":1,"prerenderedAt":2861},["ShallowReactive",2],{"article_list_xhr2_":3},[4],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"publishDate":11,"tags":12,"image":16,"excerpt":10,"body":17,"_type":2852,"_id":2853,"_source":2854,"_file":2855,"_stem":2856,"_extension":2857,"author":2858},"/ckeefer/2013-5/ajax-uploader","2013-5",false,"","Ajax Upload XHR2, Take 2","It's a pleasure to be able to interact with files in the browser at long last, isn't it? Reading files in without needing to bounce them against the server first opens up a lot of possibilities - and getting progress from a chunked ajax upload is miles away from the indeterminate form uploads of days past.","2014-02-19",[13,14,15],"jquery","js","xhr2","/ckeefer/2013-5/img/html5.jpg",{"type":18,"children":19,"toc":2847},"root",[20,27,39,54,61,75,89,694,699,704,709,714,1467,1488,1493,2796,2802,2807,2812,2818,2841],{"type":21,"tag":22,"props":23,"children":24},"element","p",{},[25],{"type":26,"value":10},"text",{"type":21,"tag":22,"props":28,"children":29},{},[30,37],{"type":21,"tag":31,"props":32,"children":34},"a",{"href":33},"/search/ajax/upload/filereader/user:ckeefer",[35],{"type":26,"value":36},"Last time",{"type":26,"value":38}," we touched this subject, I shared an (admittedly rough) jQuery plugin that allowed you to enjoy HTML5 ajax uploading and file reading with the familiar event interface, and convert any element into a drag-and-drop target.",{"type":21,"tag":22,"props":40,"children":41},{},[42,44,52],{"type":26,"value":43},"At the request of reader ",{"type":21,"tag":31,"props":45,"children":49},{"href":46,"rel":47},"https://github.com/SaneMethod/HUp/issues/1",[48],"nofollow",[50],{"type":26,"value":51},"Mateusz",{"type":26,"value":53},", let's revisit our HUp plugin, and polish it up a little by adding a new feature - the ability to filter files to be read/uploaded by their file size, and/or their mime-type.",{"type":21,"tag":55,"props":56,"children":58},"h2",{"id":57},"filtering-by-type",[59],{"type":26,"value":60},"Filtering By Type",{"type":21,"tag":22,"props":62,"children":63},{},[64,66,73],{"type":26,"value":65},"This can get tricky, given the wide variety of files and their associated mime types. We want to be able to specify something similar to the ",{"type":21,"tag":31,"props":67,"children":70},{"href":68,"rel":69},"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Specifications",[48],[71],{"type":26,"value":72},"accept attribute",{"type":26,"value":74}," on file inputs - but a little looser and friendlier, allowing just the extension to be specified, with the plugin handling the hard work of mapping that to a mime-type - at least, when we know the extension.",{"type":21,"tag":22,"props":76,"children":77},{},[78,80,87],{"type":26,"value":79},"The logic for this is split up within ",{"type":21,"tag":81,"props":82,"children":84},"code",{"className":83},[],[85],{"type":26,"value":86},"hup.js",{"type":26,"value":88},". To begin with, we need to create an array of known mime-types, and a mapping between extensions and their mime-types.",{"type":21,"tag":90,"props":91,"children":95},"pre",{"className":92,"code":93,"language":94,"meta":8,"style":8},"language-javascript shiki shiki-themes github-light github-dark","var filters = {},\n    fileTypes = [];\n    /**\n    * Populate the filters and fileTypes object and array, with the former containing a mapping between\n    * file extensions and their mime types, and the latter the mimetypes themselves.\n    */\n(function(mimetypes){\n    var mimes = mimetypes.split(/,/),\n        exts = [];\n    for (var i=0, len=mimes.length; i \u003C len; i+=2)\n    {\n        fileTypes.push(mimes[i]);\n        exts = mimes[i+1].split(/ /);\n        for (var j=0, jlen = exts.length; j \u003C jlen; j++)\n        {\n            filters[exts[j]] = mimes[i];\n        }\n    }\n})(\n        \"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,\" +\n        \"ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,\" +\n        \"ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/x-javascript,js,\" +\n        \"application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,\" +\n        \"image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,\" +\n        \"image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,\" +\n        \"csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,\" +\n        \"video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,\" +\n        \"application/octet-stream,exe\"\n    );\n","javascript",[96],{"type":21,"tag":81,"props":97,"children":98},{"__ignoreMap":8},[99,127,145,155,164,173,182,211,265,282,364,373,392,446,517,526,544,553,562,571,585,598,611,624,637,650,663,676,685],{"type":21,"tag":100,"props":101,"children":104},"span",{"class":102,"line":103},"line",1,[105,111,117,122],{"type":21,"tag":100,"props":106,"children":108},{"style":107},"--shiki-default:#D73A49;--shiki-dark:#F97583",[109],{"type":26,"value":110},"var",{"type":21,"tag":100,"props":112,"children":114},{"style":113},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[115],{"type":26,"value":116}," filters ",{"type":21,"tag":100,"props":118,"children":119},{"style":107},[120],{"type":26,"value":121},"=",{"type":21,"tag":100,"props":123,"children":124},{"style":113},[125],{"type":26,"value":126}," {},\n",{"type":21,"tag":100,"props":128,"children":130},{"class":102,"line":129},2,[131,136,140],{"type":21,"tag":100,"props":132,"children":133},{"style":113},[134],{"type":26,"value":135},"    fileTypes ",{"type":21,"tag":100,"props":137,"children":138},{"style":107},[139],{"type":26,"value":121},{"type":21,"tag":100,"props":141,"children":142},{"style":113},[143],{"type":26,"value":144}," [];\n",{"type":21,"tag":100,"props":146,"children":148},{"class":102,"line":147},3,[149],{"type":21,"tag":100,"props":150,"children":152},{"style":151},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[153],{"type":26,"value":154},"    /**\n",{"type":21,"tag":100,"props":156,"children":158},{"class":102,"line":157},4,[159],{"type":21,"tag":100,"props":160,"children":161},{"style":151},[162],{"type":26,"value":163},"    * Populate the filters and fileTypes object and array, with the former containing a mapping between\n",{"type":21,"tag":100,"props":165,"children":167},{"class":102,"line":166},5,[168],{"type":21,"tag":100,"props":169,"children":170},{"style":151},[171],{"type":26,"value":172},"    * file extensions and their mime types, and the latter the mimetypes themselves.\n",{"type":21,"tag":100,"props":174,"children":176},{"class":102,"line":175},6,[177],{"type":21,"tag":100,"props":178,"children":179},{"style":151},[180],{"type":26,"value":181},"    */\n",{"type":21,"tag":100,"props":183,"children":185},{"class":102,"line":184},7,[186,191,196,200,206],{"type":21,"tag":100,"props":187,"children":188},{"style":113},[189],{"type":26,"value":190},"(",{"type":21,"tag":100,"props":192,"children":193},{"style":107},[194],{"type":26,"value":195},"function",{"type":21,"tag":100,"props":197,"children":198},{"style":113},[199],{"type":26,"value":190},{"type":21,"tag":100,"props":201,"children":203},{"style":202},"--shiki-default:#E36209;--shiki-dark:#FFAB70",[204],{"type":26,"value":205},"mimetypes",{"type":21,"tag":100,"props":207,"children":208},{"style":113},[209],{"type":26,"value":210},"){\n",{"type":21,"tag":100,"props":212,"children":214},{"class":102,"line":213},8,[215,220,225,229,234,240,244,250,256,260],{"type":21,"tag":100,"props":216,"children":217},{"style":107},[218],{"type":26,"value":219},"    var",{"type":21,"tag":100,"props":221,"children":222},{"style":113},[223],{"type":26,"value":224}," mimes ",{"type":21,"tag":100,"props":226,"children":227},{"style":107},[228],{"type":26,"value":121},{"type":21,"tag":100,"props":230,"children":231},{"style":113},[232],{"type":26,"value":233}," mimetypes.",{"type":21,"tag":100,"props":235,"children":237},{"style":236},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[238],{"type":26,"value":239},"split",{"type":21,"tag":100,"props":241,"children":242},{"style":113},[243],{"type":26,"value":190},{"type":21,"tag":100,"props":245,"children":247},{"style":246},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[248],{"type":26,"value":249},"/",{"type":21,"tag":100,"props":251,"children":253},{"style":252},"--shiki-default:#032F62;--shiki-dark:#DBEDFF",[254],{"type":26,"value":255},",",{"type":21,"tag":100,"props":257,"children":258},{"style":246},[259],{"type":26,"value":249},{"type":21,"tag":100,"props":261,"children":262},{"style":113},[263],{"type":26,"value":264},"),\n",{"type":21,"tag":100,"props":266,"children":268},{"class":102,"line":267},9,[269,274,278],{"type":21,"tag":100,"props":270,"children":271},{"style":113},[272],{"type":26,"value":273},"        exts ",{"type":21,"tag":100,"props":275,"children":276},{"style":107},[277],{"type":26,"value":121},{"type":21,"tag":100,"props":279,"children":280},{"style":113},[281],{"type":26,"value":144},{"type":21,"tag":100,"props":283,"children":285},{"class":102,"line":284},10,[286,291,296,300,305,309,315,320,324,329,334,339,344,349,354,359],{"type":21,"tag":100,"props":287,"children":288},{"style":107},[289],{"type":26,"value":290},"    for",{"type":21,"tag":100,"props":292,"children":293},{"style":113},[294],{"type":26,"value":295}," (",{"type":21,"tag":100,"props":297,"children":298},{"style":107},[299],{"type":26,"value":110},{"type":21,"tag":100,"props":301,"children":302},{"style":113},[303],{"type":26,"value":304}," i",{"type":21,"tag":100,"props":306,"children":307},{"style":107},[308],{"type":26,"value":121},{"type":21,"tag":100,"props":310,"children":312},{"style":311},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[313],{"type":26,"value":314},"0",{"type":21,"tag":100,"props":316,"children":317},{"style":113},[318],{"type":26,"value":319},", len",{"type":21,"tag":100,"props":321,"children":322},{"style":107},[323],{"type":26,"value":121},{"type":21,"tag":100,"props":325,"children":326},{"style":113},[327],{"type":26,"value":328},"mimes.",{"type":21,"tag":100,"props":330,"children":331},{"style":311},[332],{"type":26,"value":333},"length",{"type":21,"tag":100,"props":335,"children":336},{"style":113},[337],{"type":26,"value":338},"; i ",{"type":21,"tag":100,"props":340,"children":341},{"style":107},[342],{"type":26,"value":343},"\u003C",{"type":21,"tag":100,"props":345,"children":346},{"style":113},[347],{"type":26,"value":348}," len; i",{"type":21,"tag":100,"props":350,"children":351},{"style":107},[352],{"type":26,"value":353},"+=",{"type":21,"tag":100,"props":355,"children":356},{"style":311},[357],{"type":26,"value":358},"2",{"type":21,"tag":100,"props":360,"children":361},{"style":113},[362],{"type":26,"value":363},")\n",{"type":21,"tag":100,"props":365,"children":367},{"class":102,"line":366},11,[368],{"type":21,"tag":100,"props":369,"children":370},{"style":113},[371],{"type":26,"value":372},"    {\n",{"type":21,"tag":100,"props":374,"children":376},{"class":102,"line":375},12,[377,382,387],{"type":21,"tag":100,"props":378,"children":379},{"style":113},[380],{"type":26,"value":381},"        fileTypes.",{"type":21,"tag":100,"props":383,"children":384},{"style":236},[385],{"type":26,"value":386},"push",{"type":21,"tag":100,"props":388,"children":389},{"style":113},[390],{"type":26,"value":391},"(mimes[i]);\n",{"type":21,"tag":100,"props":393,"children":395},{"class":102,"line":394},13,[396,400,404,409,414,419,424,428,432,436,441],{"type":21,"tag":100,"props":397,"children":398},{"style":113},[399],{"type":26,"value":273},{"type":21,"tag":100,"props":401,"children":402},{"style":107},[403],{"type":26,"value":121},{"type":21,"tag":100,"props":405,"children":406},{"style":113},[407],{"type":26,"value":408}," mimes[i",{"type":21,"tag":100,"props":410,"children":411},{"style":107},[412],{"type":26,"value":413},"+",{"type":21,"tag":100,"props":415,"children":416},{"style":311},[417],{"type":26,"value":418},"1",{"type":21,"tag":100,"props":420,"children":421},{"style":113},[422],{"type":26,"value":423},"].",{"type":21,"tag":100,"props":425,"children":426},{"style":236},[427],{"type":26,"value":239},{"type":21,"tag":100,"props":429,"children":430},{"style":113},[431],{"type":26,"value":190},{"type":21,"tag":100,"props":433,"children":434},{"style":246},[435],{"type":26,"value":249},{"type":21,"tag":100,"props":437,"children":438},{"style":246},[439],{"type":26,"value":440}," /",{"type":21,"tag":100,"props":442,"children":443},{"style":113},[444],{"type":26,"value":445},");\n",{"type":21,"tag":100,"props":447,"children":449},{"class":102,"line":448},14,[450,455,459,463,468,472,476,481,485,490,494,499,503,508,513],{"type":21,"tag":100,"props":451,"children":452},{"style":107},[453],{"type":26,"value":454},"        for",{"type":21,"tag":100,"props":456,"children":457},{"style":113},[458],{"type":26,"value":295},{"type":21,"tag":100,"props":460,"children":461},{"style":107},[462],{"type":26,"value":110},{"type":21,"tag":100,"props":464,"children":465},{"style":113},[466],{"type":26,"value":467}," j",{"type":21,"tag":100,"props":469,"children":470},{"style":107},[471],{"type":26,"value":121},{"type":21,"tag":100,"props":473,"children":474},{"style":311},[475],{"type":26,"value":314},{"type":21,"tag":100,"props":477,"children":478},{"style":113},[479],{"type":26,"value":480},", jlen ",{"type":21,"tag":100,"props":482,"children":483},{"style":107},[484],{"type":26,"value":121},{"type":21,"tag":100,"props":486,"children":487},{"style":113},[488],{"type":26,"value":489}," exts.",{"type":21,"tag":100,"props":491,"children":492},{"style":311},[493],{"type":26,"value":333},{"type":21,"tag":100,"props":495,"children":496},{"style":113},[497],{"type":26,"value":498},"; j ",{"type":21,"tag":100,"props":500,"children":501},{"style":107},[502],{"type":26,"value":343},{"type":21,"tag":100,"props":504,"children":505},{"style":113},[506],{"type":26,"value":507}," jlen; j",{"type":21,"tag":100,"props":509,"children":510},{"style":107},[511],{"type":26,"value":512},"++",{"type":21,"tag":100,"props":514,"children":515},{"style":113},[516],{"type":26,"value":363},{"type":21,"tag":100,"props":518,"children":520},{"class":102,"line":519},15,[521],{"type":21,"tag":100,"props":522,"children":523},{"style":113},[524],{"type":26,"value":525},"        {\n",{"type":21,"tag":100,"props":527,"children":529},{"class":102,"line":528},16,[530,535,539],{"type":21,"tag":100,"props":531,"children":532},{"style":113},[533],{"type":26,"value":534},"            filters[exts[j]] ",{"type":21,"tag":100,"props":536,"children":537},{"style":107},[538],{"type":26,"value":121},{"type":21,"tag":100,"props":540,"children":541},{"style":113},[542],{"type":26,"value":543}," mimes[i];\n",{"type":21,"tag":100,"props":545,"children":547},{"class":102,"line":546},17,[548],{"type":21,"tag":100,"props":549,"children":550},{"style":113},[551],{"type":26,"value":552},"        }\n",{"type":21,"tag":100,"props":554,"children":556},{"class":102,"line":555},18,[557],{"type":21,"tag":100,"props":558,"children":559},{"style":113},[560],{"type":26,"value":561},"    }\n",{"type":21,"tag":100,"props":563,"children":565},{"class":102,"line":564},19,[566],{"type":21,"tag":100,"props":567,"children":568},{"style":113},[569],{"type":26,"value":570},"})(\n",{"type":21,"tag":100,"props":572,"children":574},{"class":102,"line":573},20,[575,580],{"type":21,"tag":100,"props":576,"children":577},{"style":246},[578],{"type":26,"value":579},"        \"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,\"",{"type":21,"tag":100,"props":581,"children":582},{"style":107},[583],{"type":26,"value":584}," +\n",{"type":21,"tag":100,"props":586,"children":588},{"class":102,"line":587},21,[589,594],{"type":21,"tag":100,"props":590,"children":591},{"style":246},[592],{"type":26,"value":593},"        \"ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,\"",{"type":21,"tag":100,"props":595,"children":596},{"style":107},[597],{"type":26,"value":584},{"type":21,"tag":100,"props":599,"children":601},{"class":102,"line":600},22,[602,607],{"type":21,"tag":100,"props":603,"children":604},{"style":246},[605],{"type":26,"value":606},"        \"ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/x-javascript,js,\"",{"type":21,"tag":100,"props":608,"children":609},{"style":107},[610],{"type":26,"value":584},{"type":21,"tag":100,"props":612,"children":614},{"class":102,"line":613},23,[615,620],{"type":21,"tag":100,"props":616,"children":617},{"style":246},[618],{"type":26,"value":619},"        \"application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,\"",{"type":21,"tag":100,"props":621,"children":622},{"style":107},[623],{"type":26,"value":584},{"type":21,"tag":100,"props":625,"children":627},{"class":102,"line":626},24,[628,633],{"type":21,"tag":100,"props":629,"children":630},{"style":246},[631],{"type":26,"value":632},"        \"image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,\"",{"type":21,"tag":100,"props":634,"children":635},{"style":107},[636],{"type":26,"value":584},{"type":21,"tag":100,"props":638,"children":640},{"class":102,"line":639},25,[641,646],{"type":21,"tag":100,"props":642,"children":643},{"style":246},[644],{"type":26,"value":645},"        \"image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,\"",{"type":21,"tag":100,"props":647,"children":648},{"style":107},[649],{"type":26,"value":584},{"type":21,"tag":100,"props":651,"children":653},{"class":102,"line":652},26,[654,659],{"type":21,"tag":100,"props":655,"children":656},{"style":246},[657],{"type":26,"value":658},"        \"csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,\"",{"type":21,"tag":100,"props":660,"children":661},{"style":107},[662],{"type":26,"value":584},{"type":21,"tag":100,"props":664,"children":666},{"class":102,"line":665},27,[667,672],{"type":21,"tag":100,"props":668,"children":669},{"style":246},[670],{"type":26,"value":671},"        \"video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,\"",{"type":21,"tag":100,"props":673,"children":674},{"style":107},[675],{"type":26,"value":584},{"type":21,"tag":100,"props":677,"children":679},{"class":102,"line":678},28,[680],{"type":21,"tag":100,"props":681,"children":682},{"style":246},[683],{"type":26,"value":684},"        \"application/octet-stream,exe\"\n",{"type":21,"tag":100,"props":686,"children":688},{"class":102,"line":687},29,[689],{"type":21,"tag":100,"props":690,"children":691},{"style":113},[692],{"type":26,"value":693},"    );\n",{"type":21,"tag":22,"props":695,"children":696},{},[697],{"type":26,"value":698},"You're probably wincing a bit at the two var declarations at the top, but remember this is in a closure - those aren't global, they're local to the closure. The function that populates the array and object will run once, when the plugin closure itself first executes.",{"type":21,"tag":22,"props":700,"children":701},{},[702],{"type":26,"value":703},"So what's happening here? We have a mixed comma and space delimited list of known mime-types and extensions, with the extensions always next to their relevant mime-type. We first split the list on commas and push the first element (the mime-type), to our fileTypes array. Then, we split the i+1 element (the file extensions) on space, and create a key for each of the extensions with the value the mime-type.",{"type":21,"tag":22,"props":705,"children":706},{},[707],{"type":26,"value":708},"Why build our array and object from a string like this, instead of just specifying them statically? Well, besides the advantage of being able to build two objects for the price of one (that is, both the array and filter), this allows for easy editing and extension of our admittedly incomplete mime-type and file extension list. Need to add another file extension that should be considered application/octet-stream? Just add a space and the new extension next to exe there. Want to have .md files considered as text/plain? Just drop the extension in next to log.",{"type":21,"tag":22,"props":710,"children":711},{},[712],{"type":26,"value":713},"Next, when the plugin is called on an element with accept set in its options:",{"type":21,"tag":90,"props":715,"children":717},{"className":92,"code":716,"language":94,"meta":8,"style":8},"/**\n* Translate the accept string or array into an array of mime types, based on the mime types in filters.\n* Input should look like the expected extensions:\n* \"swf, wmv, mp4\" or ['swf', 'wmv', 'mp4']\n* Or like mime type categories, or the mime types themselves:\n* \"application/*, application/pdf\" or ['image/\u003Cem>', 'plain/text']\n* @param {array|string} accept\n*/\nHup.prototype.acceptFilters = function(accept){\n    var mimes = [];\n    // Ensure accept is an array of extensions or mime types\n    if (typeof accept === 'string' || accept instanceof String)\n    {\n        accept = accept.split(/,/);\n    }\n    for (var i=0, len = accept.length; i \u003C len; i++)\n    {\n        var mime = accept[i].trim().split(///);\n        if (mime.length > 1)\n        {\n            if (mime[1] === '\u003C/em>')\n            {\n                // Every mime-type that begins with mime[0] now needs to be pushed into the mimes array\n                for (var j=0, jlen = fileTypes.length; j \u003C jlen; j++)\n                {\n                    var fileType = fileTypes[j].split(///);\n                    if (mime[0] === fileType[0]) mimes.push(fileTypes[j]);\n                }\n            } else {\n                // Pass the mime type through unmolested\n                mimes.push(mime.join('/'));\n            }\n        } else {\n            // Only an extension has been specified - map to the mime type\n            if (mime[0] in filters) mimes.push(filters[mime[0]]);\n        }\n    }\n    return mimes;\n};\n",[718],{"type":21,"tag":81,"props":719,"children":720},{"__ignoreMap":8},[721,729,737,745,753,761,769,792,800,850,869,877,932,939,980,987,1051,1058,1103,1134,1141,1181,1189,1197,1262,1270,1304,1353,1361,1369,1378,1397,1406,1415,1424,1433,1441,1449,1458],{"type":21,"tag":100,"props":722,"children":723},{"class":102,"line":103},[724],{"type":21,"tag":100,"props":725,"children":726},{"style":151},[727],{"type":26,"value":728},"/**\n",{"type":21,"tag":100,"props":730,"children":731},{"class":102,"line":129},[732],{"type":21,"tag":100,"props":733,"children":734},{"style":151},[735],{"type":26,"value":736},"* Translate the accept string or array into an array of mime types, based on the mime types in filters.\n",{"type":21,"tag":100,"props":738,"children":739},{"class":102,"line":147},[740],{"type":21,"tag":100,"props":741,"children":742},{"style":151},[743],{"type":26,"value":744},"* Input should look like the expected extensions:\n",{"type":21,"tag":100,"props":746,"children":747},{"class":102,"line":157},[748],{"type":21,"tag":100,"props":749,"children":750},{"style":151},[751],{"type":26,"value":752},"* \"swf, wmv, mp4\" or ['swf', 'wmv', 'mp4']\n",{"type":21,"tag":100,"props":754,"children":755},{"class":102,"line":166},[756],{"type":21,"tag":100,"props":757,"children":758},{"style":151},[759],{"type":26,"value":760},"* Or like mime type categories, or the mime types themselves:\n",{"type":21,"tag":100,"props":762,"children":763},{"class":102,"line":175},[764],{"type":21,"tag":100,"props":765,"children":766},{"style":151},[767],{"type":26,"value":768},"* \"application/*, application/pdf\" or ['image/\u003Cem>', 'plain/text']\n",{"type":21,"tag":100,"props":770,"children":771},{"class":102,"line":184},[772,777,782,787],{"type":21,"tag":100,"props":773,"children":774},{"style":151},[775],{"type":26,"value":776},"* ",{"type":21,"tag":100,"props":778,"children":779},{"style":107},[780],{"type":26,"value":781},"@param",{"type":21,"tag":100,"props":783,"children":784},{"style":236},[785],{"type":26,"value":786}," {array|string}",{"type":21,"tag":100,"props":788,"children":789},{"style":113},[790],{"type":26,"value":791}," accept\n",{"type":21,"tag":100,"props":793,"children":794},{"class":102,"line":213},[795],{"type":21,"tag":100,"props":796,"children":797},{"style":151},[798],{"type":26,"value":799},"*/\n",{"type":21,"tag":100,"props":801,"children":802},{"class":102,"line":267},[803,808,813,818,822,827,832,837,841,846],{"type":21,"tag":100,"props":804,"children":805},{"style":311},[806],{"type":26,"value":807},"Hup",{"type":21,"tag":100,"props":809,"children":810},{"style":113},[811],{"type":26,"value":812},".",{"type":21,"tag":100,"props":814,"children":815},{"style":311},[816],{"type":26,"value":817},"prototype",{"type":21,"tag":100,"props":819,"children":820},{"style":113},[821],{"type":26,"value":812},{"type":21,"tag":100,"props":823,"children":824},{"style":236},[825],{"type":26,"value":826},"acceptFilters",{"type":21,"tag":100,"props":828,"children":829},{"style":107},[830],{"type":26,"value":831}," =",{"type":21,"tag":100,"props":833,"children":834},{"style":107},[835],{"type":26,"value":836}," function",{"type":21,"tag":100,"props":838,"children":839},{"style":113},[840],{"type":26,"value":190},{"type":21,"tag":100,"props":842,"children":843},{"style":202},[844],{"type":26,"value":845},"accept",{"type":21,"tag":100,"props":847,"children":848},{"style":113},[849],{"type":26,"value":210},{"type":21,"tag":100,"props":851,"children":852},{"class":102,"line":284},[853,857,861,865],{"type":21,"tag":100,"props":854,"children":855},{"style":107},[856],{"type":26,"value":219},{"type":21,"tag":100,"props":858,"children":859},{"style":113},[860],{"type":26,"value":224},{"type":21,"tag":100,"props":862,"children":863},{"style":107},[864],{"type":26,"value":121},{"type":21,"tag":100,"props":866,"children":867},{"style":113},[868],{"type":26,"value":144},{"type":21,"tag":100,"props":870,"children":871},{"class":102,"line":366},[872],{"type":21,"tag":100,"props":873,"children":874},{"style":151},[875],{"type":26,"value":876},"    // Ensure accept is an array of extensions or mime types\n",{"type":21,"tag":100,"props":878,"children":879},{"class":102,"line":375},[880,885,889,894,899,904,909,914,918,923,928],{"type":21,"tag":100,"props":881,"children":882},{"style":107},[883],{"type":26,"value":884},"    if",{"type":21,"tag":100,"props":886,"children":887},{"style":113},[888],{"type":26,"value":295},{"type":21,"tag":100,"props":890,"children":891},{"style":107},[892],{"type":26,"value":893},"typeof",{"type":21,"tag":100,"props":895,"children":896},{"style":113},[897],{"type":26,"value":898}," accept ",{"type":21,"tag":100,"props":900,"children":901},{"style":107},[902],{"type":26,"value":903},"===",{"type":21,"tag":100,"props":905,"children":906},{"style":246},[907],{"type":26,"value":908}," 'string'",{"type":21,"tag":100,"props":910,"children":911},{"style":107},[912],{"type":26,"value":913}," ||",{"type":21,"tag":100,"props":915,"children":916},{"style":113},[917],{"type":26,"value":898},{"type":21,"tag":100,"props":919,"children":920},{"style":107},[921],{"type":26,"value":922},"instanceof",{"type":21,"tag":100,"props":924,"children":925},{"style":236},[926],{"type":26,"value":927}," String",{"type":21,"tag":100,"props":929,"children":930},{"style":113},[931],{"type":26,"value":363},{"type":21,"tag":100,"props":933,"children":934},{"class":102,"line":394},[935],{"type":21,"tag":100,"props":936,"children":937},{"style":113},[938],{"type":26,"value":372},{"type":21,"tag":100,"props":940,"children":941},{"class":102,"line":448},[942,947,951,956,960,964,968,972,976],{"type":21,"tag":100,"props":943,"children":944},{"style":113},[945],{"type":26,"value":946},"        accept ",{"type":21,"tag":100,"props":948,"children":949},{"style":107},[950],{"type":26,"value":121},{"type":21,"tag":100,"props":952,"children":953},{"style":113},[954],{"type":26,"value":955}," accept.",{"type":21,"tag":100,"props":957,"children":958},{"style":236},[959],{"type":26,"value":239},{"type":21,"tag":100,"props":961,"children":962},{"style":113},[963],{"type":26,"value":190},{"type":21,"tag":100,"props":965,"children":966},{"style":246},[967],{"type":26,"value":249},{"type":21,"tag":100,"props":969,"children":970},{"style":252},[971],{"type":26,"value":255},{"type":21,"tag":100,"props":973,"children":974},{"style":246},[975],{"type":26,"value":249},{"type":21,"tag":100,"props":977,"children":978},{"style":113},[979],{"type":26,"value":445},{"type":21,"tag":100,"props":981,"children":982},{"class":102,"line":519},[983],{"type":21,"tag":100,"props":984,"children":985},{"style":113},[986],{"type":26,"value":561},{"type":21,"tag":100,"props":988,"children":989},{"class":102,"line":528},[990,994,998,1002,1006,1010,1014,1019,1023,1027,1031,1035,1039,1043,1047],{"type":21,"tag":100,"props":991,"children":992},{"style":107},[993],{"type":26,"value":290},{"type":21,"tag":100,"props":995,"children":996},{"style":113},[997],{"type":26,"value":295},{"type":21,"tag":100,"props":999,"children":1000},{"style":107},[1001],{"type":26,"value":110},{"type":21,"tag":100,"props":1003,"children":1004},{"style":113},[1005],{"type":26,"value":304},{"type":21,"tag":100,"props":1007,"children":1008},{"style":107},[1009],{"type":26,"value":121},{"type":21,"tag":100,"props":1011,"children":1012},{"style":311},[1013],{"type":26,"value":314},{"type":21,"tag":100,"props":1015,"children":1016},{"style":113},[1017],{"type":26,"value":1018},", len ",{"type":21,"tag":100,"props":1020,"children":1021},{"style":107},[1022],{"type":26,"value":121},{"type":21,"tag":100,"props":1024,"children":1025},{"style":113},[1026],{"type":26,"value":955},{"type":21,"tag":100,"props":1028,"children":1029},{"style":311},[1030],{"type":26,"value":333},{"type":21,"tag":100,"props":1032,"children":1033},{"style":113},[1034],{"type":26,"value":338},{"type":21,"tag":100,"props":1036,"children":1037},{"style":107},[1038],{"type":26,"value":343},{"type":21,"tag":100,"props":1040,"children":1041},{"style":113},[1042],{"type":26,"value":348},{"type":21,"tag":100,"props":1044,"children":1045},{"style":107},[1046],{"type":26,"value":512},{"type":21,"tag":100,"props":1048,"children":1049},{"style":113},[1050],{"type":26,"value":363},{"type":21,"tag":100,"props":1052,"children":1053},{"class":102,"line":546},[1054],{"type":21,"tag":100,"props":1055,"children":1056},{"style":113},[1057],{"type":26,"value":372},{"type":21,"tag":100,"props":1059,"children":1060},{"class":102,"line":555},[1061,1066,1071,1075,1080,1085,1090,1094,1098],{"type":21,"tag":100,"props":1062,"children":1063},{"style":107},[1064],{"type":26,"value":1065},"        var",{"type":21,"tag":100,"props":1067,"children":1068},{"style":113},[1069],{"type":26,"value":1070}," mime ",{"type":21,"tag":100,"props":1072,"children":1073},{"style":107},[1074],{"type":26,"value":121},{"type":21,"tag":100,"props":1076,"children":1077},{"style":113},[1078],{"type":26,"value":1079}," accept[i].",{"type":21,"tag":100,"props":1081,"children":1082},{"style":236},[1083],{"type":26,"value":1084},"trim",{"type":21,"tag":100,"props":1086,"children":1087},{"style":113},[1088],{"type":26,"value":1089},"().",{"type":21,"tag":100,"props":1091,"children":1092},{"style":236},[1093],{"type":26,"value":239},{"type":21,"tag":100,"props":1095,"children":1096},{"style":113},[1097],{"type":26,"value":190},{"type":21,"tag":100,"props":1099,"children":1100},{"style":151},[1101],{"type":26,"value":1102},"///);\n",{"type":21,"tag":100,"props":1104,"children":1105},{"class":102,"line":564},[1106,1111,1116,1120,1125,1130],{"type":21,"tag":100,"props":1107,"children":1108},{"style":236},[1109],{"type":26,"value":1110},"        if",{"type":21,"tag":100,"props":1112,"children":1113},{"style":113},[1114],{"type":26,"value":1115}," (mime.",{"type":21,"tag":100,"props":1117,"children":1118},{"style":311},[1119],{"type":26,"value":333},{"type":21,"tag":100,"props":1121,"children":1122},{"style":107},[1123],{"type":26,"value":1124}," >",{"type":21,"tag":100,"props":1126,"children":1127},{"style":311},[1128],{"type":26,"value":1129}," 1",{"type":21,"tag":100,"props":1131,"children":1132},{"style":113},[1133],{"type":26,"value":363},{"type":21,"tag":100,"props":1135,"children":1136},{"class":102,"line":573},[1137],{"type":21,"tag":100,"props":1138,"children":1139},{"style":113},[1140],{"type":26,"value":525},{"type":21,"tag":100,"props":1142,"children":1143},{"class":102,"line":587},[1144,1149,1153,1158,1163,1167,1172,1177],{"type":21,"tag":100,"props":1145,"children":1146},{"style":236},[1147],{"type":26,"value":1148},"            if",{"type":21,"tag":100,"props":1150,"children":1151},{"style":113},[1152],{"type":26,"value":295},{"type":21,"tag":100,"props":1154,"children":1155},{"style":202},[1156],{"type":26,"value":1157},"mime",{"type":21,"tag":100,"props":1159,"children":1160},{"style":113},[1161],{"type":26,"value":1162},"[",{"type":21,"tag":100,"props":1164,"children":1165},{"style":311},[1166],{"type":26,"value":418},{"type":21,"tag":100,"props":1168,"children":1169},{"style":113},[1170],{"type":26,"value":1171},"] === ",{"type":21,"tag":100,"props":1173,"children":1174},{"style":246},[1175],{"type":26,"value":1176},"'\u003C/em>'",{"type":21,"tag":100,"props":1178,"children":1179},{"style":113},[1180],{"type":26,"value":363},{"type":21,"tag":100,"props":1182,"children":1183},{"class":102,"line":600},[1184],{"type":21,"tag":100,"props":1185,"children":1186},{"style":113},[1187],{"type":26,"value":1188},"            {\n",{"type":21,"tag":100,"props":1190,"children":1191},{"class":102,"line":613},[1192],{"type":21,"tag":100,"props":1193,"children":1194},{"style":151},[1195],{"type":26,"value":1196},"                // Every mime-type that begins with mime[0] now needs to be pushed into the mimes array\n",{"type":21,"tag":100,"props":1198,"children":1199},{"class":102,"line":626},[1200,1205,1209,1213,1217,1221,1225,1229,1233,1238,1242,1246,1250,1254,1258],{"type":21,"tag":100,"props":1201,"children":1202},{"style":107},[1203],{"type":26,"value":1204},"                for",{"type":21,"tag":100,"props":1206,"children":1207},{"style":113},[1208],{"type":26,"value":295},{"type":21,"tag":100,"props":1210,"children":1211},{"style":107},[1212],{"type":26,"value":110},{"type":21,"tag":100,"props":1214,"children":1215},{"style":113},[1216],{"type":26,"value":467},{"type":21,"tag":100,"props":1218,"children":1219},{"style":107},[1220],{"type":26,"value":121},{"type":21,"tag":100,"props":1222,"children":1223},{"style":311},[1224],{"type":26,"value":314},{"type":21,"tag":100,"props":1226,"children":1227},{"style":113},[1228],{"type":26,"value":480},{"type":21,"tag":100,"props":1230,"children":1231},{"style":107},[1232],{"type":26,"value":121},{"type":21,"tag":100,"props":1234,"children":1235},{"style":113},[1236],{"type":26,"value":1237}," fileTypes.",{"type":21,"tag":100,"props":1239,"children":1240},{"style":311},[1241],{"type":26,"value":333},{"type":21,"tag":100,"props":1243,"children":1244},{"style":113},[1245],{"type":26,"value":498},{"type":21,"tag":100,"props":1247,"children":1248},{"style":107},[1249],{"type":26,"value":343},{"type":21,"tag":100,"props":1251,"children":1252},{"style":113},[1253],{"type":26,"value":507},{"type":21,"tag":100,"props":1255,"children":1256},{"style":107},[1257],{"type":26,"value":512},{"type":21,"tag":100,"props":1259,"children":1260},{"style":113},[1261],{"type":26,"value":363},{"type":21,"tag":100,"props":1263,"children":1264},{"class":102,"line":639},[1265],{"type":21,"tag":100,"props":1266,"children":1267},{"style":113},[1268],{"type":26,"value":1269},"                {\n",{"type":21,"tag":100,"props":1271,"children":1272},{"class":102,"line":652},[1273,1278,1283,1287,1292,1296,1300],{"type":21,"tag":100,"props":1274,"children":1275},{"style":107},[1276],{"type":26,"value":1277},"                    var",{"type":21,"tag":100,"props":1279,"children":1280},{"style":113},[1281],{"type":26,"value":1282}," fileType ",{"type":21,"tag":100,"props":1284,"children":1285},{"style":107},[1286],{"type":26,"value":121},{"type":21,"tag":100,"props":1288,"children":1289},{"style":113},[1290],{"type":26,"value":1291}," fileTypes[j].",{"type":21,"tag":100,"props":1293,"children":1294},{"style":236},[1295],{"type":26,"value":239},{"type":21,"tag":100,"props":1297,"children":1298},{"style":113},[1299],{"type":26,"value":190},{"type":21,"tag":100,"props":1301,"children":1302},{"style":151},[1303],{"type":26,"value":1102},{"type":21,"tag":100,"props":1305,"children":1306},{"class":102,"line":665},[1307,1312,1317,1321,1326,1330,1335,1339,1344,1348],{"type":21,"tag":100,"props":1308,"children":1309},{"style":236},[1310],{"type":26,"value":1311},"                    if",{"type":21,"tag":100,"props":1313,"children":1314},{"style":113},[1315],{"type":26,"value":1316}," (mime[",{"type":21,"tag":100,"props":1318,"children":1319},{"style":311},[1320],{"type":26,"value":314},{"type":21,"tag":100,"props":1322,"children":1323},{"style":113},[1324],{"type":26,"value":1325},"] ",{"type":21,"tag":100,"props":1327,"children":1328},{"style":107},[1329],{"type":26,"value":903},{"type":21,"tag":100,"props":1331,"children":1332},{"style":113},[1333],{"type":26,"value":1334}," fileType[",{"type":21,"tag":100,"props":1336,"children":1337},{"style":311},[1338],{"type":26,"value":314},{"type":21,"tag":100,"props":1340,"children":1341},{"style":113},[1342],{"type":26,"value":1343},"]) mimes.",{"type":21,"tag":100,"props":1345,"children":1346},{"style":236},[1347],{"type":26,"value":386},{"type":21,"tag":100,"props":1349,"children":1350},{"style":113},[1351],{"type":26,"value":1352},"(fileTypes[j]);\n",{"type":21,"tag":100,"props":1354,"children":1355},{"class":102,"line":678},[1356],{"type":21,"tag":100,"props":1357,"children":1358},{"style":113},[1359],{"type":26,"value":1360},"                }\n",{"type":21,"tag":100,"props":1362,"children":1363},{"class":102,"line":687},[1364],{"type":21,"tag":100,"props":1365,"children":1366},{"style":113},[1367],{"type":26,"value":1368},"            } else {\n",{"type":21,"tag":100,"props":1370,"children":1372},{"class":102,"line":1371},30,[1373],{"type":21,"tag":100,"props":1374,"children":1375},{"style":151},[1376],{"type":26,"value":1377},"                // Pass the mime type through unmolested\n",{"type":21,"tag":100,"props":1379,"children":1381},{"class":102,"line":1380},31,[1382,1387,1392],{"type":21,"tag":100,"props":1383,"children":1384},{"style":113},[1385],{"type":26,"value":1386},"                mimes.push(mime.join(",{"type":21,"tag":100,"props":1388,"children":1389},{"style":246},[1390],{"type":26,"value":1391},"'/'",{"type":21,"tag":100,"props":1393,"children":1394},{"style":113},[1395],{"type":26,"value":1396},"));\n",{"type":21,"tag":100,"props":1398,"children":1400},{"class":102,"line":1399},32,[1401],{"type":21,"tag":100,"props":1402,"children":1403},{"style":113},[1404],{"type":26,"value":1405},"            }\n",{"type":21,"tag":100,"props":1407,"children":1409},{"class":102,"line":1408},33,[1410],{"type":21,"tag":100,"props":1411,"children":1412},{"style":113},[1413],{"type":26,"value":1414},"        } else {\n",{"type":21,"tag":100,"props":1416,"children":1418},{"class":102,"line":1417},34,[1419],{"type":21,"tag":100,"props":1420,"children":1421},{"style":151},[1422],{"type":26,"value":1423},"            // Only an extension has been specified - map to the mime type\n",{"type":21,"tag":100,"props":1425,"children":1427},{"class":102,"line":1426},35,[1428],{"type":21,"tag":100,"props":1429,"children":1430},{"style":113},[1431],{"type":26,"value":1432},"            if (mime[0] in filters) mimes.push(filters[mime[0]]);\n",{"type":21,"tag":100,"props":1434,"children":1436},{"class":102,"line":1435},36,[1437],{"type":21,"tag":100,"props":1438,"children":1439},{"style":113},[1440],{"type":26,"value":552},{"type":21,"tag":100,"props":1442,"children":1444},{"class":102,"line":1443},37,[1445],{"type":21,"tag":100,"props":1446,"children":1447},{"style":113},[1448],{"type":26,"value":561},{"type":21,"tag":100,"props":1450,"children":1452},{"class":102,"line":1451},38,[1453],{"type":21,"tag":100,"props":1454,"children":1455},{"style":113},[1456],{"type":26,"value":1457},"    return mimes;\n",{"type":21,"tag":100,"props":1459,"children":1461},{"class":102,"line":1460},39,[1462],{"type":21,"tag":100,"props":1463,"children":1464},{"style":113},[1465],{"type":26,"value":1466},"};\n",{"type":21,"tag":22,"props":1468,"children":1469},{},[1470,1472,1478,1480,1486],{"type":26,"value":1471},"Here, we allow the plugin user to set accept on the plugin as either a string or an array, and generate our mimes filter array from it. This allows us to be more permissive than the standard accept filter, with: ",{"type":21,"tag":81,"props":1473,"children":1475},{"className":1474},[],[1476],{"type":26,"value":1477},"\"wmv, audio/_, swf\" or ['wmv', 'audio/_', 'swf']",{"type":26,"value":1479}," both being valid. Notice the wildcard in the above example? In acceptFilters, we split on the forward slash and if the second part is a wildcard, we add every mime-type that matches the first part to the mimes filter array. If both parts are specified (ie. 'plain/text'), we pass it through unchanged (save for trimming any whitespace) - this allows the user to add mime-types that aren't in our list (ie. video/ogg, audio/flac, etc.). These can be combined - so if you want to allow any audio type, and include ones that aren't explicit in our list, you can specify ",{"type":21,"tag":81,"props":1481,"children":1483},{"className":1482},[],[1484],{"type":26,"value":1485},"['audio/*', 'audio/flac', 'audio/alac', 'audio/ogg']",{"type":26,"value":1487}," to do just that.",{"type":21,"tag":22,"props":1489,"children":1490},{},[1491],{"type":26,"value":1492},"Finally, when we're iterating through the fileList, we make our checks against the mimetype of the file in the fileList and, if its not in our accept filter, we fire a new event of type FILE_TYPE_ERROR and continue on to the next file in the list.",{"type":21,"tag":90,"props":1494,"children":1496},{"className":92,"code":1495,"language":94,"meta":8,"style":8}," /**\n* Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n* memory and passing them on to be used in the browser.\n* @param files\n* @param upload\n*/\nHup.prototype.processFiles = function(files, upload){\n    var that = this,\n        processed = 0,\n        accept = this.options.accept,\n        accepted = false,\n        maxSize = this.options.max_file_size,\n        fprocess;\n\nfor (var i=0, len = files.length; i &lt; len; i++)\n{\n    // Check file against mime accept restrictions if any restrictions are set\n    if (accept.length)\n    {\n        accepted = false;\n        for (var j=0, jlen = accept.length; j &lt; jlen; j++)\n        {\n            accepted = (files[i].type === accept[j]);\n            if (accepted) break;\n        }\n        if (!accepted)\n        {\n            this.input.trigger(Hup.state.FILE_TYPE_ERROR,\n                {state:Hup.state.FILE_TYPE_ERROR,\n                    error:'File type is '+files[i].type+', accepted types are '+\n                        accept.join(',')+'.'});\n            continue;\n        }\n    }\n    // Check file against size restrictions\n    if (maxSize &amp;&amp; files[i].size &gt; maxSize)\n    {\n        this.input.trigger(Hup.state.FILE_SIZE_ERROR,\n            {state:Hup.state.FILE_SIZE_ERROR,\n                error:'File size is '+files[i].size+', max file size is '+maxSize+'.'});\n        continue;\n    }\n    // Create new DeferXhr or DeferReader and listen on its progression and completion to fire the appropriate\n    // events for interested listeners on our input\n    fprocess = (upload) ? new DeferXhr(this.options, files[i]) :\n        new DeferReader(this.options.read_method, files[i]);\n\n    fprocess.progress(function(progress){\n        that.input.trigger(progress.state, progress);\n    }).done(function(res){\n        that.input.trigger(res.state, res);\n        processed++;\n        if (processed &gt;= len){\n            that.input.trigger((upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL ,\n                {state:(upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL, files:len});\n        }\n    }).fail(function(res)\n    {\n        that.input.trigger(res.state, res);\n    });\n}\n\n};\n",[1497],{"type":21,"tag":81,"props":1498,"children":1499},{"__ignoreMap":8},[1500,1508,1516,1524,1540,1556,1563,1618,1644,1665,1685,1706,1727,1735,1744,1811,1819,1827,1847,1854,1874,1938,1945,1971,1992,1999,2020,2027,2059,2075,2111,2152,2164,2171,2178,2186,2225,2232,2261,2277,2330,2343,2351,2360,2369,2421,2448,2456,2490,2508,2543,2560,2577,2608,2659,2697,2705,2738,2746,2762,2771,2780,2788],{"type":21,"tag":100,"props":1501,"children":1502},{"class":102,"line":103},[1503],{"type":21,"tag":100,"props":1504,"children":1505},{"style":151},[1506],{"type":26,"value":1507}," /**\n",{"type":21,"tag":100,"props":1509,"children":1510},{"class":102,"line":129},[1511],{"type":21,"tag":100,"props":1512,"children":1513},{"style":151},[1514],{"type":26,"value":1515},"* Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n",{"type":21,"tag":100,"props":1517,"children":1518},{"class":102,"line":147},[1519],{"type":21,"tag":100,"props":1520,"children":1521},{"style":151},[1522],{"type":26,"value":1523},"* memory and passing them on to be used in the browser.\n",{"type":21,"tag":100,"props":1525,"children":1526},{"class":102,"line":157},[1527,1531,1535],{"type":21,"tag":100,"props":1528,"children":1529},{"style":151},[1530],{"type":26,"value":776},{"type":21,"tag":100,"props":1532,"children":1533},{"style":107},[1534],{"type":26,"value":781},{"type":21,"tag":100,"props":1536,"children":1537},{"style":113},[1538],{"type":26,"value":1539}," files\n",{"type":21,"tag":100,"props":1541,"children":1542},{"class":102,"line":166},[1543,1547,1551],{"type":21,"tag":100,"props":1544,"children":1545},{"style":151},[1546],{"type":26,"value":776},{"type":21,"tag":100,"props":1548,"children":1549},{"style":107},[1550],{"type":26,"value":781},{"type":21,"tag":100,"props":1552,"children":1553},{"style":113},[1554],{"type":26,"value":1555}," upload\n",{"type":21,"tag":100,"props":1557,"children":1558},{"class":102,"line":175},[1559],{"type":21,"tag":100,"props":1560,"children":1561},{"style":151},[1562],{"type":26,"value":799},{"type":21,"tag":100,"props":1564,"children":1565},{"class":102,"line":184},[1566,1570,1574,1578,1582,1587,1591,1595,1599,1604,1609,1614],{"type":21,"tag":100,"props":1567,"children":1568},{"style":311},[1569],{"type":26,"value":807},{"type":21,"tag":100,"props":1571,"children":1572},{"style":113},[1573],{"type":26,"value":812},{"type":21,"tag":100,"props":1575,"children":1576},{"style":311},[1577],{"type":26,"value":817},{"type":21,"tag":100,"props":1579,"children":1580},{"style":113},[1581],{"type":26,"value":812},{"type":21,"tag":100,"props":1583,"children":1584},{"style":236},[1585],{"type":26,"value":1586},"processFiles",{"type":21,"tag":100,"props":1588,"children":1589},{"style":107},[1590],{"type":26,"value":831},{"type":21,"tag":100,"props":1592,"children":1593},{"style":107},[1594],{"type":26,"value":836},{"type":21,"tag":100,"props":1596,"children":1597},{"style":113},[1598],{"type":26,"value":190},{"type":21,"tag":100,"props":1600,"children":1601},{"style":202},[1602],{"type":26,"value":1603},"files",{"type":21,"tag":100,"props":1605,"children":1606},{"style":113},[1607],{"type":26,"value":1608},", ",{"type":21,"tag":100,"props":1610,"children":1611},{"style":202},[1612],{"type":26,"value":1613},"upload",{"type":21,"tag":100,"props":1615,"children":1616},{"style":113},[1617],{"type":26,"value":210},{"type":21,"tag":100,"props":1619,"children":1620},{"class":102,"line":213},[1621,1625,1630,1634,1639],{"type":21,"tag":100,"props":1622,"children":1623},{"style":107},[1624],{"type":26,"value":219},{"type":21,"tag":100,"props":1626,"children":1627},{"style":113},[1628],{"type":26,"value":1629}," that ",{"type":21,"tag":100,"props":1631,"children":1632},{"style":107},[1633],{"type":26,"value":121},{"type":21,"tag":100,"props":1635,"children":1636},{"style":311},[1637],{"type":26,"value":1638}," this",{"type":21,"tag":100,"props":1640,"children":1641},{"style":113},[1642],{"type":26,"value":1643},",\n",{"type":21,"tag":100,"props":1645,"children":1646},{"class":102,"line":267},[1647,1652,1656,1661],{"type":21,"tag":100,"props":1648,"children":1649},{"style":113},[1650],{"type":26,"value":1651},"        processed ",{"type":21,"tag":100,"props":1653,"children":1654},{"style":107},[1655],{"type":26,"value":121},{"type":21,"tag":100,"props":1657,"children":1658},{"style":311},[1659],{"type":26,"value":1660}," 0",{"type":21,"tag":100,"props":1662,"children":1663},{"style":113},[1664],{"type":26,"value":1643},{"type":21,"tag":100,"props":1666,"children":1667},{"class":102,"line":284},[1668,1672,1676,1680],{"type":21,"tag":100,"props":1669,"children":1670},{"style":113},[1671],{"type":26,"value":946},{"type":21,"tag":100,"props":1673,"children":1674},{"style":107},[1675],{"type":26,"value":121},{"type":21,"tag":100,"props":1677,"children":1678},{"style":311},[1679],{"type":26,"value":1638},{"type":21,"tag":100,"props":1681,"children":1682},{"style":113},[1683],{"type":26,"value":1684},".options.accept,\n",{"type":21,"tag":100,"props":1686,"children":1687},{"class":102,"line":366},[1688,1693,1697,1702],{"type":21,"tag":100,"props":1689,"children":1690},{"style":113},[1691],{"type":26,"value":1692},"        accepted ",{"type":21,"tag":100,"props":1694,"children":1695},{"style":107},[1696],{"type":26,"value":121},{"type":21,"tag":100,"props":1698,"children":1699},{"style":311},[1700],{"type":26,"value":1701}," false",{"type":21,"tag":100,"props":1703,"children":1704},{"style":113},[1705],{"type":26,"value":1643},{"type":21,"tag":100,"props":1707,"children":1708},{"class":102,"line":375},[1709,1714,1718,1722],{"type":21,"tag":100,"props":1710,"children":1711},{"style":113},[1712],{"type":26,"value":1713},"        maxSize ",{"type":21,"tag":100,"props":1715,"children":1716},{"style":107},[1717],{"type":26,"value":121},{"type":21,"tag":100,"props":1719,"children":1720},{"style":311},[1721],{"type":26,"value":1638},{"type":21,"tag":100,"props":1723,"children":1724},{"style":113},[1725],{"type":26,"value":1726},".options.max_file_size,\n",{"type":21,"tag":100,"props":1728,"children":1729},{"class":102,"line":394},[1730],{"type":21,"tag":100,"props":1731,"children":1732},{"style":113},[1733],{"type":26,"value":1734},"        fprocess;\n",{"type":21,"tag":100,"props":1736,"children":1737},{"class":102,"line":448},[1738],{"type":21,"tag":100,"props":1739,"children":1741},{"emptyLinePlaceholder":1740},true,[1742],{"type":26,"value":1743},"\n",{"type":21,"tag":100,"props":1745,"children":1746},{"class":102,"line":519},[1747,1752,1756,1760,1764,1768,1772,1776,1780,1785,1789,1793,1798,1803,1807],{"type":21,"tag":100,"props":1748,"children":1749},{"style":107},[1750],{"type":26,"value":1751},"for",{"type":21,"tag":100,"props":1753,"children":1754},{"style":113},[1755],{"type":26,"value":295},{"type":21,"tag":100,"props":1757,"children":1758},{"style":107},[1759],{"type":26,"value":110},{"type":21,"tag":100,"props":1761,"children":1762},{"style":113},[1763],{"type":26,"value":304},{"type":21,"tag":100,"props":1765,"children":1766},{"style":107},[1767],{"type":26,"value":121},{"type":21,"tag":100,"props":1769,"children":1770},{"style":311},[1771],{"type":26,"value":314},{"type":21,"tag":100,"props":1773,"children":1774},{"style":113},[1775],{"type":26,"value":1018},{"type":21,"tag":100,"props":1777,"children":1778},{"style":107},[1779],{"type":26,"value":121},{"type":21,"tag":100,"props":1781,"children":1782},{"style":113},[1783],{"type":26,"value":1784}," files.",{"type":21,"tag":100,"props":1786,"children":1787},{"style":311},[1788],{"type":26,"value":333},{"type":21,"tag":100,"props":1790,"children":1791},{"style":113},[1792],{"type":26,"value":338},{"type":21,"tag":100,"props":1794,"children":1795},{"style":107},[1796],{"type":26,"value":1797},"&",{"type":21,"tag":100,"props":1799,"children":1800},{"style":113},[1801],{"type":26,"value":1802},"lt; len; i",{"type":21,"tag":100,"props":1804,"children":1805},{"style":107},[1806],{"type":26,"value":512},{"type":21,"tag":100,"props":1808,"children":1809},{"style":113},[1810],{"type":26,"value":363},{"type":21,"tag":100,"props":1812,"children":1813},{"class":102,"line":528},[1814],{"type":21,"tag":100,"props":1815,"children":1816},{"style":113},[1817],{"type":26,"value":1818},"{\n",{"type":21,"tag":100,"props":1820,"children":1821},{"class":102,"line":546},[1822],{"type":21,"tag":100,"props":1823,"children":1824},{"style":151},[1825],{"type":26,"value":1826},"    // Check file against mime accept restrictions if any restrictions are set\n",{"type":21,"tag":100,"props":1828,"children":1829},{"class":102,"line":555},[1830,1834,1839,1843],{"type":21,"tag":100,"props":1831,"children":1832},{"style":107},[1833],{"type":26,"value":884},{"type":21,"tag":100,"props":1835,"children":1836},{"style":113},[1837],{"type":26,"value":1838}," (accept.",{"type":21,"tag":100,"props":1840,"children":1841},{"style":311},[1842],{"type":26,"value":333},{"type":21,"tag":100,"props":1844,"children":1845},{"style":113},[1846],{"type":26,"value":363},{"type":21,"tag":100,"props":1848,"children":1849},{"class":102,"line":564},[1850],{"type":21,"tag":100,"props":1851,"children":1852},{"style":113},[1853],{"type":26,"value":372},{"type":21,"tag":100,"props":1855,"children":1856},{"class":102,"line":573},[1857,1861,1865,1869],{"type":21,"tag":100,"props":1858,"children":1859},{"style":113},[1860],{"type":26,"value":1692},{"type":21,"tag":100,"props":1862,"children":1863},{"style":107},[1864],{"type":26,"value":121},{"type":21,"tag":100,"props":1866,"children":1867},{"style":311},[1868],{"type":26,"value":1701},{"type":21,"tag":100,"props":1870,"children":1871},{"style":113},[1872],{"type":26,"value":1873},";\n",{"type":21,"tag":100,"props":1875,"children":1876},{"class":102,"line":587},[1877,1881,1885,1889,1893,1897,1901,1905,1909,1913,1917,1921,1925,1930,1934],{"type":21,"tag":100,"props":1878,"children":1879},{"style":107},[1880],{"type":26,"value":454},{"type":21,"tag":100,"props":1882,"children":1883},{"style":113},[1884],{"type":26,"value":295},{"type":21,"tag":100,"props":1886,"children":1887},{"style":107},[1888],{"type":26,"value":110},{"type":21,"tag":100,"props":1890,"children":1891},{"style":113},[1892],{"type":26,"value":467},{"type":21,"tag":100,"props":1894,"children":1895},{"style":107},[1896],{"type":26,"value":121},{"type":21,"tag":100,"props":1898,"children":1899},{"style":311},[1900],{"type":26,"value":314},{"type":21,"tag":100,"props":1902,"children":1903},{"style":113},[1904],{"type":26,"value":480},{"type":21,"tag":100,"props":1906,"children":1907},{"style":107},[1908],{"type":26,"value":121},{"type":21,"tag":100,"props":1910,"children":1911},{"style":113},[1912],{"type":26,"value":955},{"type":21,"tag":100,"props":1914,"children":1915},{"style":311},[1916],{"type":26,"value":333},{"type":21,"tag":100,"props":1918,"children":1919},{"style":113},[1920],{"type":26,"value":498},{"type":21,"tag":100,"props":1922,"children":1923},{"style":107},[1924],{"type":26,"value":1797},{"type":21,"tag":100,"props":1926,"children":1927},{"style":113},[1928],{"type":26,"value":1929},"lt; jlen; j",{"type":21,"tag":100,"props":1931,"children":1932},{"style":107},[1933],{"type":26,"value":512},{"type":21,"tag":100,"props":1935,"children":1936},{"style":113},[1937],{"type":26,"value":363},{"type":21,"tag":100,"props":1939,"children":1940},{"class":102,"line":600},[1941],{"type":21,"tag":100,"props":1942,"children":1943},{"style":113},[1944],{"type":26,"value":525},{"type":21,"tag":100,"props":1946,"children":1947},{"class":102,"line":613},[1948,1953,1957,1962,1966],{"type":21,"tag":100,"props":1949,"children":1950},{"style":113},[1951],{"type":26,"value":1952},"            accepted ",{"type":21,"tag":100,"props":1954,"children":1955},{"style":107},[1956],{"type":26,"value":121},{"type":21,"tag":100,"props":1958,"children":1959},{"style":113},[1960],{"type":26,"value":1961}," (files[i].type ",{"type":21,"tag":100,"props":1963,"children":1964},{"style":107},[1965],{"type":26,"value":903},{"type":21,"tag":100,"props":1967,"children":1968},{"style":113},[1969],{"type":26,"value":1970}," accept[j]);\n",{"type":21,"tag":100,"props":1972,"children":1973},{"class":102,"line":626},[1974,1978,1983,1988],{"type":21,"tag":100,"props":1975,"children":1976},{"style":107},[1977],{"type":26,"value":1148},{"type":21,"tag":100,"props":1979,"children":1980},{"style":113},[1981],{"type":26,"value":1982}," (accepted) ",{"type":21,"tag":100,"props":1984,"children":1985},{"style":107},[1986],{"type":26,"value":1987},"break",{"type":21,"tag":100,"props":1989,"children":1990},{"style":113},[1991],{"type":26,"value":1873},{"type":21,"tag":100,"props":1993,"children":1994},{"class":102,"line":639},[1995],{"type":21,"tag":100,"props":1996,"children":1997},{"style":113},[1998],{"type":26,"value":552},{"type":21,"tag":100,"props":2000,"children":2001},{"class":102,"line":652},[2002,2006,2010,2015],{"type":21,"tag":100,"props":2003,"children":2004},{"style":107},[2005],{"type":26,"value":1110},{"type":21,"tag":100,"props":2007,"children":2008},{"style":113},[2009],{"type":26,"value":295},{"type":21,"tag":100,"props":2011,"children":2012},{"style":107},[2013],{"type":26,"value":2014},"!",{"type":21,"tag":100,"props":2016,"children":2017},{"style":113},[2018],{"type":26,"value":2019},"accepted)\n",{"type":21,"tag":100,"props":2021,"children":2022},{"class":102,"line":665},[2023],{"type":21,"tag":100,"props":2024,"children":2025},{"style":113},[2026],{"type":26,"value":525},{"type":21,"tag":100,"props":2028,"children":2029},{"class":102,"line":678},[2030,2035,2040,2045,2050,2055],{"type":21,"tag":100,"props":2031,"children":2032},{"style":311},[2033],{"type":26,"value":2034},"            this",{"type":21,"tag":100,"props":2036,"children":2037},{"style":113},[2038],{"type":26,"value":2039},".input.",{"type":21,"tag":100,"props":2041,"children":2042},{"style":236},[2043],{"type":26,"value":2044},"trigger",{"type":21,"tag":100,"props":2046,"children":2047},{"style":113},[2048],{"type":26,"value":2049},"(Hup.state.",{"type":21,"tag":100,"props":2051,"children":2052},{"style":311},[2053],{"type":26,"value":2054},"FILE_TYPE_ERROR",{"type":21,"tag":100,"props":2056,"children":2057},{"style":113},[2058],{"type":26,"value":1643},{"type":21,"tag":100,"props":2060,"children":2061},{"class":102,"line":687},[2062,2067,2071],{"type":21,"tag":100,"props":2063,"children":2064},{"style":113},[2065],{"type":26,"value":2066},"                {state:Hup.state.",{"type":21,"tag":100,"props":2068,"children":2069},{"style":311},[2070],{"type":26,"value":2054},{"type":21,"tag":100,"props":2072,"children":2073},{"style":113},[2074],{"type":26,"value":1643},{"type":21,"tag":100,"props":2076,"children":2077},{"class":102,"line":1371},[2078,2083,2088,2092,2097,2101,2106],{"type":21,"tag":100,"props":2079,"children":2080},{"style":113},[2081],{"type":26,"value":2082},"                    error:",{"type":21,"tag":100,"props":2084,"children":2085},{"style":246},[2086],{"type":26,"value":2087},"'File type is '",{"type":21,"tag":100,"props":2089,"children":2090},{"style":107},[2091],{"type":26,"value":413},{"type":21,"tag":100,"props":2093,"children":2094},{"style":113},[2095],{"type":26,"value":2096},"files[i].type",{"type":21,"tag":100,"props":2098,"children":2099},{"style":107},[2100],{"type":26,"value":413},{"type":21,"tag":100,"props":2102,"children":2103},{"style":246},[2104],{"type":26,"value":2105},"', accepted types are '",{"type":21,"tag":100,"props":2107,"children":2108},{"style":107},[2109],{"type":26,"value":2110},"+\n",{"type":21,"tag":100,"props":2112,"children":2113},{"class":102,"line":1380},[2114,2119,2124,2128,2133,2138,2142,2147],{"type":21,"tag":100,"props":2115,"children":2116},{"style":113},[2117],{"type":26,"value":2118},"                        accept.",{"type":21,"tag":100,"props":2120,"children":2121},{"style":236},[2122],{"type":26,"value":2123},"join",{"type":21,"tag":100,"props":2125,"children":2126},{"style":113},[2127],{"type":26,"value":190},{"type":21,"tag":100,"props":2129,"children":2130},{"style":246},[2131],{"type":26,"value":2132},"','",{"type":21,"tag":100,"props":2134,"children":2135},{"style":113},[2136],{"type":26,"value":2137},")",{"type":21,"tag":100,"props":2139,"children":2140},{"style":107},[2141],{"type":26,"value":413},{"type":21,"tag":100,"props":2143,"children":2144},{"style":246},[2145],{"type":26,"value":2146},"'.'",{"type":21,"tag":100,"props":2148,"children":2149},{"style":113},[2150],{"type":26,"value":2151},"});\n",{"type":21,"tag":100,"props":2153,"children":2154},{"class":102,"line":1399},[2155,2160],{"type":21,"tag":100,"props":2156,"children":2157},{"style":107},[2158],{"type":26,"value":2159},"            continue",{"type":21,"tag":100,"props":2161,"children":2162},{"style":113},[2163],{"type":26,"value":1873},{"type":21,"tag":100,"props":2165,"children":2166},{"class":102,"line":1408},[2167],{"type":21,"tag":100,"props":2168,"children":2169},{"style":113},[2170],{"type":26,"value":552},{"type":21,"tag":100,"props":2172,"children":2173},{"class":102,"line":1417},[2174],{"type":21,"tag":100,"props":2175,"children":2176},{"style":113},[2177],{"type":26,"value":561},{"type":21,"tag":100,"props":2179,"children":2180},{"class":102,"line":1426},[2181],{"type":21,"tag":100,"props":2182,"children":2183},{"style":151},[2184],{"type":26,"value":2185},"    // Check file against size restrictions\n",{"type":21,"tag":100,"props":2187,"children":2188},{"class":102,"line":1435},[2189,2193,2198,2202,2207,2211,2216,2220],{"type":21,"tag":100,"props":2190,"children":2191},{"style":107},[2192],{"type":26,"value":884},{"type":21,"tag":100,"props":2194,"children":2195},{"style":113},[2196],{"type":26,"value":2197}," (maxSize ",{"type":21,"tag":100,"props":2199,"children":2200},{"style":107},[2201],{"type":26,"value":1797},{"type":21,"tag":100,"props":2203,"children":2204},{"style":113},[2205],{"type":26,"value":2206},"amp;",{"type":21,"tag":100,"props":2208,"children":2209},{"style":107},[2210],{"type":26,"value":1797},{"type":21,"tag":100,"props":2212,"children":2213},{"style":113},[2214],{"type":26,"value":2215},"amp; files[i].size ",{"type":21,"tag":100,"props":2217,"children":2218},{"style":107},[2219],{"type":26,"value":1797},{"type":21,"tag":100,"props":2221,"children":2222},{"style":113},[2223],{"type":26,"value":2224},"gt; maxSize)\n",{"type":21,"tag":100,"props":2226,"children":2227},{"class":102,"line":1443},[2228],{"type":21,"tag":100,"props":2229,"children":2230},{"style":113},[2231],{"type":26,"value":372},{"type":21,"tag":100,"props":2233,"children":2234},{"class":102,"line":1451},[2235,2240,2244,2248,2252,2257],{"type":21,"tag":100,"props":2236,"children":2237},{"style":311},[2238],{"type":26,"value":2239},"        this",{"type":21,"tag":100,"props":2241,"children":2242},{"style":113},[2243],{"type":26,"value":2039},{"type":21,"tag":100,"props":2245,"children":2246},{"style":236},[2247],{"type":26,"value":2044},{"type":21,"tag":100,"props":2249,"children":2250},{"style":113},[2251],{"type":26,"value":2049},{"type":21,"tag":100,"props":2253,"children":2254},{"style":311},[2255],{"type":26,"value":2256},"FILE_SIZE_ERROR",{"type":21,"tag":100,"props":2258,"children":2259},{"style":113},[2260],{"type":26,"value":1643},{"type":21,"tag":100,"props":2262,"children":2263},{"class":102,"line":1460},[2264,2269,2273],{"type":21,"tag":100,"props":2265,"children":2266},{"style":113},[2267],{"type":26,"value":2268},"            {state:Hup.state.",{"type":21,"tag":100,"props":2270,"children":2271},{"style":311},[2272],{"type":26,"value":2256},{"type":21,"tag":100,"props":2274,"children":2275},{"style":113},[2276],{"type":26,"value":1643},{"type":21,"tag":100,"props":2278,"children":2280},{"class":102,"line":2279},40,[2281,2286,2291,2295,2300,2304,2309,2313,2318,2322,2326],{"type":21,"tag":100,"props":2282,"children":2283},{"style":113},[2284],{"type":26,"value":2285},"                error:",{"type":21,"tag":100,"props":2287,"children":2288},{"style":246},[2289],{"type":26,"value":2290},"'File size is '",{"type":21,"tag":100,"props":2292,"children":2293},{"style":107},[2294],{"type":26,"value":413},{"type":21,"tag":100,"props":2296,"children":2297},{"style":113},[2298],{"type":26,"value":2299},"files[i].size",{"type":21,"tag":100,"props":2301,"children":2302},{"style":107},[2303],{"type":26,"value":413},{"type":21,"tag":100,"props":2305,"children":2306},{"style":246},[2307],{"type":26,"value":2308},"', max file size is '",{"type":21,"tag":100,"props":2310,"children":2311},{"style":107},[2312],{"type":26,"value":413},{"type":21,"tag":100,"props":2314,"children":2315},{"style":113},[2316],{"type":26,"value":2317},"maxSize",{"type":21,"tag":100,"props":2319,"children":2320},{"style":107},[2321],{"type":26,"value":413},{"type":21,"tag":100,"props":2323,"children":2324},{"style":246},[2325],{"type":26,"value":2146},{"type":21,"tag":100,"props":2327,"children":2328},{"style":113},[2329],{"type":26,"value":2151},{"type":21,"tag":100,"props":2331,"children":2333},{"class":102,"line":2332},41,[2334,2339],{"type":21,"tag":100,"props":2335,"children":2336},{"style":107},[2337],{"type":26,"value":2338},"        continue",{"type":21,"tag":100,"props":2340,"children":2341},{"style":113},[2342],{"type":26,"value":1873},{"type":21,"tag":100,"props":2344,"children":2346},{"class":102,"line":2345},42,[2347],{"type":21,"tag":100,"props":2348,"children":2349},{"style":113},[2350],{"type":26,"value":561},{"type":21,"tag":100,"props":2352,"children":2354},{"class":102,"line":2353},43,[2355],{"type":21,"tag":100,"props":2356,"children":2357},{"style":151},[2358],{"type":26,"value":2359},"    // Create new DeferXhr or DeferReader and listen on its progression and completion to fire the appropriate\n",{"type":21,"tag":100,"props":2361,"children":2363},{"class":102,"line":2362},44,[2364],{"type":21,"tag":100,"props":2365,"children":2366},{"style":151},[2367],{"type":26,"value":2368},"    // events for interested listeners on our input\n",{"type":21,"tag":100,"props":2370,"children":2372},{"class":102,"line":2371},45,[2373,2378,2382,2387,2392,2397,2402,2406,2411,2416],{"type":21,"tag":100,"props":2374,"children":2375},{"style":113},[2376],{"type":26,"value":2377},"    fprocess ",{"type":21,"tag":100,"props":2379,"children":2380},{"style":107},[2381],{"type":26,"value":121},{"type":21,"tag":100,"props":2383,"children":2384},{"style":113},[2385],{"type":26,"value":2386}," (upload) ",{"type":21,"tag":100,"props":2388,"children":2389},{"style":107},[2390],{"type":26,"value":2391},"?",{"type":21,"tag":100,"props":2393,"children":2394},{"style":107},[2395],{"type":26,"value":2396}," new",{"type":21,"tag":100,"props":2398,"children":2399},{"style":236},[2400],{"type":26,"value":2401}," DeferXhr",{"type":21,"tag":100,"props":2403,"children":2404},{"style":113},[2405],{"type":26,"value":190},{"type":21,"tag":100,"props":2407,"children":2408},{"style":311},[2409],{"type":26,"value":2410},"this",{"type":21,"tag":100,"props":2412,"children":2413},{"style":113},[2414],{"type":26,"value":2415},".options, files[i]) ",{"type":21,"tag":100,"props":2417,"children":2418},{"style":107},[2419],{"type":26,"value":2420},":\n",{"type":21,"tag":100,"props":2422,"children":2424},{"class":102,"line":2423},46,[2425,2430,2435,2439,2443],{"type":21,"tag":100,"props":2426,"children":2427},{"style":107},[2428],{"type":26,"value":2429},"        new",{"type":21,"tag":100,"props":2431,"children":2432},{"style":236},[2433],{"type":26,"value":2434}," DeferReader",{"type":21,"tag":100,"props":2436,"children":2437},{"style":113},[2438],{"type":26,"value":190},{"type":21,"tag":100,"props":2440,"children":2441},{"style":311},[2442],{"type":26,"value":2410},{"type":21,"tag":100,"props":2444,"children":2445},{"style":113},[2446],{"type":26,"value":2447},".options.read_method, files[i]);\n",{"type":21,"tag":100,"props":2449,"children":2451},{"class":102,"line":2450},47,[2452],{"type":21,"tag":100,"props":2453,"children":2454},{"emptyLinePlaceholder":1740},[2455],{"type":26,"value":1743},{"type":21,"tag":100,"props":2457,"children":2459},{"class":102,"line":2458},48,[2460,2465,2470,2474,2478,2482,2486],{"type":21,"tag":100,"props":2461,"children":2462},{"style":113},[2463],{"type":26,"value":2464},"    fprocess.",{"type":21,"tag":100,"props":2466,"children":2467},{"style":236},[2468],{"type":26,"value":2469},"progress",{"type":21,"tag":100,"props":2471,"children":2472},{"style":113},[2473],{"type":26,"value":190},{"type":21,"tag":100,"props":2475,"children":2476},{"style":107},[2477],{"type":26,"value":195},{"type":21,"tag":100,"props":2479,"children":2480},{"style":113},[2481],{"type":26,"value":190},{"type":21,"tag":100,"props":2483,"children":2484},{"style":202},[2485],{"type":26,"value":2469},{"type":21,"tag":100,"props":2487,"children":2488},{"style":113},[2489],{"type":26,"value":210},{"type":21,"tag":100,"props":2491,"children":2493},{"class":102,"line":2492},49,[2494,2499,2503],{"type":21,"tag":100,"props":2495,"children":2496},{"style":113},[2497],{"type":26,"value":2498},"        that.input.",{"type":21,"tag":100,"props":2500,"children":2501},{"style":236},[2502],{"type":26,"value":2044},{"type":21,"tag":100,"props":2504,"children":2505},{"style":113},[2506],{"type":26,"value":2507},"(progress.state, progress);\n",{"type":21,"tag":100,"props":2509,"children":2511},{"class":102,"line":2510},50,[2512,2517,2522,2526,2530,2534,2539],{"type":21,"tag":100,"props":2513,"children":2514},{"style":113},[2515],{"type":26,"value":2516},"    }).",{"type":21,"tag":100,"props":2518,"children":2519},{"style":236},[2520],{"type":26,"value":2521},"done",{"type":21,"tag":100,"props":2523,"children":2524},{"style":113},[2525],{"type":26,"value":190},{"type":21,"tag":100,"props":2527,"children":2528},{"style":107},[2529],{"type":26,"value":195},{"type":21,"tag":100,"props":2531,"children":2532},{"style":113},[2533],{"type":26,"value":190},{"type":21,"tag":100,"props":2535,"children":2536},{"style":202},[2537],{"type":26,"value":2538},"res",{"type":21,"tag":100,"props":2540,"children":2541},{"style":113},[2542],{"type":26,"value":210},{"type":21,"tag":100,"props":2544,"children":2546},{"class":102,"line":2545},51,[2547,2551,2555],{"type":21,"tag":100,"props":2548,"children":2549},{"style":113},[2550],{"type":26,"value":2498},{"type":21,"tag":100,"props":2552,"children":2553},{"style":236},[2554],{"type":26,"value":2044},{"type":21,"tag":100,"props":2556,"children":2557},{"style":113},[2558],{"type":26,"value":2559},"(res.state, res);\n",{"type":21,"tag":100,"props":2561,"children":2563},{"class":102,"line":2562},52,[2564,2569,2573],{"type":21,"tag":100,"props":2565,"children":2566},{"style":113},[2567],{"type":26,"value":2568},"        processed",{"type":21,"tag":100,"props":2570,"children":2571},{"style":107},[2572],{"type":26,"value":512},{"type":21,"tag":100,"props":2574,"children":2575},{"style":113},[2576],{"type":26,"value":1873},{"type":21,"tag":100,"props":2578,"children":2580},{"class":102,"line":2579},53,[2581,2585,2590,2594,2599,2603],{"type":21,"tag":100,"props":2582,"children":2583},{"style":107},[2584],{"type":26,"value":1110},{"type":21,"tag":100,"props":2586,"children":2587},{"style":113},[2588],{"type":26,"value":2589}," (processed ",{"type":21,"tag":100,"props":2591,"children":2592},{"style":107},[2593],{"type":26,"value":1797},{"type":21,"tag":100,"props":2595,"children":2596},{"style":113},[2597],{"type":26,"value":2598},"gt;",{"type":21,"tag":100,"props":2600,"children":2601},{"style":107},[2602],{"type":26,"value":121},{"type":21,"tag":100,"props":2604,"children":2605},{"style":113},[2606],{"type":26,"value":2607}," len){\n",{"type":21,"tag":100,"props":2609,"children":2611},{"class":102,"line":2610},54,[2612,2617,2621,2626,2630,2635,2640,2645,2649,2654],{"type":21,"tag":100,"props":2613,"children":2614},{"style":113},[2615],{"type":26,"value":2616},"            that.input.",{"type":21,"tag":100,"props":2618,"children":2619},{"style":236},[2620],{"type":26,"value":2044},{"type":21,"tag":100,"props":2622,"children":2623},{"style":113},[2624],{"type":26,"value":2625},"((upload) ",{"type":21,"tag":100,"props":2627,"children":2628},{"style":107},[2629],{"type":26,"value":2391},{"type":21,"tag":100,"props":2631,"children":2632},{"style":113},[2633],{"type":26,"value":2634}," Hup.state.",{"type":21,"tag":100,"props":2636,"children":2637},{"style":311},[2638],{"type":26,"value":2639},"FILE_UPLOAD_ALL",{"type":21,"tag":100,"props":2641,"children":2642},{"style":107},[2643],{"type":26,"value":2644}," :",{"type":21,"tag":100,"props":2646,"children":2647},{"style":113},[2648],{"type":26,"value":2634},{"type":21,"tag":100,"props":2650,"children":2651},{"style":311},[2652],{"type":26,"value":2653},"FILE_READ_ALL",{"type":21,"tag":100,"props":2655,"children":2656},{"style":113},[2657],{"type":26,"value":2658}," ,\n",{"type":21,"tag":100,"props":2660,"children":2662},{"class":102,"line":2661},55,[2663,2668,2672,2676,2680,2684,2688,2692],{"type":21,"tag":100,"props":2664,"children":2665},{"style":113},[2666],{"type":26,"value":2667},"                {state:(upload) ",{"type":21,"tag":100,"props":2669,"children":2670},{"style":107},[2671],{"type":26,"value":2391},{"type":21,"tag":100,"props":2673,"children":2674},{"style":113},[2675],{"type":26,"value":2634},{"type":21,"tag":100,"props":2677,"children":2678},{"style":311},[2679],{"type":26,"value":2639},{"type":21,"tag":100,"props":2681,"children":2682},{"style":107},[2683],{"type":26,"value":2644},{"type":21,"tag":100,"props":2685,"children":2686},{"style":113},[2687],{"type":26,"value":2634},{"type":21,"tag":100,"props":2689,"children":2690},{"style":311},[2691],{"type":26,"value":2653},{"type":21,"tag":100,"props":2693,"children":2694},{"style":113},[2695],{"type":26,"value":2696},", files:len});\n",{"type":21,"tag":100,"props":2698,"children":2700},{"class":102,"line":2699},56,[2701],{"type":21,"tag":100,"props":2702,"children":2703},{"style":113},[2704],{"type":26,"value":552},{"type":21,"tag":100,"props":2706,"children":2708},{"class":102,"line":2707},57,[2709,2713,2718,2722,2726,2730,2734],{"type":21,"tag":100,"props":2710,"children":2711},{"style":113},[2712],{"type":26,"value":2516},{"type":21,"tag":100,"props":2714,"children":2715},{"style":236},[2716],{"type":26,"value":2717},"fail",{"type":21,"tag":100,"props":2719,"children":2720},{"style":113},[2721],{"type":26,"value":190},{"type":21,"tag":100,"props":2723,"children":2724},{"style":107},[2725],{"type":26,"value":195},{"type":21,"tag":100,"props":2727,"children":2728},{"style":113},[2729],{"type":26,"value":190},{"type":21,"tag":100,"props":2731,"children":2732},{"style":202},[2733],{"type":26,"value":2538},{"type":21,"tag":100,"props":2735,"children":2736},{"style":113},[2737],{"type":26,"value":363},{"type":21,"tag":100,"props":2739,"children":2741},{"class":102,"line":2740},58,[2742],{"type":21,"tag":100,"props":2743,"children":2744},{"style":113},[2745],{"type":26,"value":372},{"type":21,"tag":100,"props":2747,"children":2749},{"class":102,"line":2748},59,[2750,2754,2758],{"type":21,"tag":100,"props":2751,"children":2752},{"style":113},[2753],{"type":26,"value":2498},{"type":21,"tag":100,"props":2755,"children":2756},{"style":236},[2757],{"type":26,"value":2044},{"type":21,"tag":100,"props":2759,"children":2760},{"style":113},[2761],{"type":26,"value":2559},{"type":21,"tag":100,"props":2763,"children":2765},{"class":102,"line":2764},60,[2766],{"type":21,"tag":100,"props":2767,"children":2768},{"style":113},[2769],{"type":26,"value":2770},"    });\n",{"type":21,"tag":100,"props":2772,"children":2774},{"class":102,"line":2773},61,[2775],{"type":21,"tag":100,"props":2776,"children":2777},{"style":113},[2778],{"type":26,"value":2779},"}\n",{"type":21,"tag":100,"props":2781,"children":2783},{"class":102,"line":2782},62,[2784],{"type":21,"tag":100,"props":2785,"children":2786},{"emptyLinePlaceholder":1740},[2787],{"type":26,"value":1743},{"type":21,"tag":100,"props":2789,"children":2791},{"class":102,"line":2790},63,[2792],{"type":21,"tag":100,"props":2793,"children":2794},{"style":113},[2795],{"type":26,"value":1466},{"type":21,"tag":55,"props":2797,"children":2799},{"id":2798},"filtering-by-size",[2800],{"type":26,"value":2801},"Filtering By Size",{"type":21,"tag":22,"props":2803,"children":2804},{},[2805],{"type":26,"value":2806},"This is absurdly simple by comparison - the code above makes it clear we simply test the file size against the max size that the plugin user has set, and if we're above that, fire an event of type FILE_SIZE_ERROR with a meaningful error message.",{"type":21,"tag":22,"props":2808,"children":2809},{},[2810],{"type":26,"value":2811},"The test against maxSize before testing the fileSize is to allow the default value (0) to mean no maximum file size has been set - relying on js to understand 0 as a 'falsey' value. If max size is 0, then we skip the file size test entirely. Similarly, if no mime-types are in the accept array, we skip filtering the files by their type.",{"type":21,"tag":55,"props":2813,"children":2815},{"id":2814},"better-docs",[2816],{"type":26,"value":2817},"Better Docs",{"type":21,"tag":22,"props":2819,"children":2820},{},[2821,2823,2830,2832,2839],{"type":26,"value":2822},"The documentation for HUp was a bit rushed. I followed the lead of my (still very alpha) ",{"type":21,"tag":31,"props":2824,"children":2827},{"href":2825,"rel":2826},"https://github.com/SaneMethod/KisKit",[48],[2828],{"type":26,"value":2829},"PHP Framework KisKit",{"type":26,"value":2831}," End Shameless Plug and tidied it up a bit. ",{"type":21,"tag":31,"props":2833,"children":2836},{"href":2834,"rel":2835},"https://github.com/SaneMethod/HUp",[48],[2837],{"type":26,"value":2838},"Take a look for yourself",{"type":26,"value":2840},", and feel free to open up an issue if you find bugs / want enhancements - your request might well make for a good future post. ;)",{"type":21,"tag":2842,"props":2843,"children":2844},"style",{},[2845],{"type":26,"value":2846},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":8,"searchDepth":147,"depth":147,"links":2848},[2849,2850,2851],{"id":57,"depth":129,"text":60},{"id":2798,"depth":129,"text":2801},{"id":2814,"depth":129,"text":2817},"markdown","content:ckeefer:2013-5:ajax-uploader.md","content","ckeefer/2013-5/ajax-uploader.md","ckeefer/2013-5/ajax-uploader","md",{"user":2859,"name":2860},"ckeefer","Christopher Keefer",1780330271140]