wire/modules/Inputfield/InputfieldImage/InputfieldImage.js
/**
			 * Traverse files queued for upload
			 * 
			 * @param files
			 * 
			 */
Traverse files queued for upload

@param files
Traverse files queued for upload @param files
function traverseFiles(files, xhr) {
				var toKilobyte = function(i) {
					return parseInt(i / 1024, 10);
				};
				if(typeof files === "undefined") {
					fileList.innerHTML = "No support for the File API in this web browser";
					return;
				}
				for(var i = 0, l = files.length; i < l; i++) {
					var extension = files[i].name.split('.').pop().toLowerCase();
					var message;
					if(extensions.indexOf(extension) == -1) {
						if(typeof ProcessWire.config.InputfieldFile.labels['bad-ext'] != "undefined") {
							message = ProcessWire.config.InputfieldFile.labels['bad-ext'];
							message = message.replace('EXTENSIONS', extensions);
						} else {
							message = extension + ' is a invalid file extension, please use one of:  ' + extensions;
						}
						$errorParent.append(errorItem(message, files[i].name));
					} else if(!useClientResize && files[i].size > maxFilesize && maxFilesize > 2000000) {
						var filesizeKB = toKilobyte(files[i].size),
							maxFilesizeKB = toKilobyte(maxFilesize);
						if(typeof ProcessWire.config.InputfieldFile.labels['too-big'] != "undefined") {
							message = ProcessWire.config.InputfieldFile.labels['too-big'];
							message = message.replace('MAX_KB', maxFilesizeKB);
						} else {
							message = 'Filesize ' + filesizeKB + ' kb is too big. Maximum allowed is ' + maxFilesizeKB + ' kb';
						}
						$errorParent.append(errorItem(message, files[i].name));
					} else if(typeof xhr != "undefined") {
						uploadFile(files[i], extension, xhr);
					} else {
						uploadFile(files[i], extension);
					}
					if(maxFiles == 1) break;
				}
			}
function traverseFiles ( files , xhr ) { var toKilobyte = function ( i ) { return parseInt ( i / 1024 , 10 ) ; } ; if ( typeof files === "undefined" ) { fileList . innerHTML = "No support for the File API in this web browser" ; return ; } for ( var i = 0 , l = files . length ; i < l ; i ++ ) { var extension = files [ i ] . name . split ( '.' ) . pop ( ) . toLowerCase ( ) ; var message ; if ( extensions . indexOf ( extension ) == - 1 ) { if ( typeof ProcessWire . config . InputfieldFile . labels [ 'bad-ext' ] != "undefined" ) { message = ProcessWire . config . InputfieldFile . labels [ 'bad-ext' ] ; message = message . replace ( 'EXTENSIONS' , extensions ) ; } else { message = extension + ' is a invalid file extension, please use one of:  ' + extensions ; } $errorParent . append ( errorItem ( message , files [ i ] . name ) ) ; } else if ( ! useClientResize && files [ i ] . size > maxFilesize && maxFilesize > 2000000 ) { var filesizeKB = toKilobyte ( files [ i ] . size ) , maxFilesizeKB = toKilobyte ( maxFilesize ) ; if ( typeof ProcessWire . config . InputfieldFile . labels [ 'too-big' ] != "undefined" ) { message = ProcessWire . config . InputfieldFile . labels [ 'too-big' ] ; message = message . replace ( 'MAX_KB' , maxFilesizeKB ) ; } else { message = 'Filesize ' + filesizeKB + ' kb is too big. Maximum allowed is ' + maxFilesizeKB + ' kb' ; } $errorParent . append ( errorItem ( message , files [ i ] . name ) ) ; } else if ( typeof xhr != "undefined" ) { uploadFile ( files [ i ] , extension , xhr ) ; } else { uploadFile ( files [ i ] , extension ) ; } if ( maxFiles == 1 ) break ; } }
Traverse files queued for upload
Traverse files queued for upload
// I do this test only if maxFilesize is at least 2M (php default).  // There might (not sure though) be some issues to get that value so don't want to overvalidate here -apeisa