question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jQuery .getFiles is not a function

See original GitHub issue

Bare with me… I’m very new at this. I have the following code in jQuery and am trying to get the list of files using getFiles() method.

	FilePond.registerPlugin(
		FilePondPluginImagePreview,
		FilePondPluginImageExifOrientation,
		FilePondPluginFileValidateSize,
		FilePondPluginFileValidateType
	);

	$('.filePond').filepond({
		acceptedFileTypes: ['image/jpeg', 'video/mp4'],
		fileValidateTypeLabelExpectedTypesMap: { 'image/jpeg': '.jpg', 'video/mp4': '.mp4' },
		allowFileTypeValidation: true,
		instantUpload: true,
		labelIdle: 'Drag & Drop your pictures & video or <span class="filepond--label-action">Browse</span>',
		maxFileSize: '100MB',
		maxTotalFileSize: '100MB',
		server: {
			url: '/includes/ajax.asp',
			process: {
				url: '?Action=ProcessUpload',
				onload: test
			},
			fetch: null,
			revert: null
		}
	});

	function test() {
		console.log( FilePond.getFiles() );
	}

SUMMARY After successfully processing a file the test() function executes and errors out with Uncaught TypeError: FilePond.getFiles is not a function

I have also tried using $(‘.filePond’).filepond().getFiles() which also errors out.

EXPECTED BEHAVIOR I would like to get a list of all the files processed.

Environment Version
OS Windows 10
Device Desktop
Browser Chrome 72.0.3626.119

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

4reactions
Racquetballercommented, Mar 6, 2019

After some more testing I was able to figure it out.

function test() {
	var files = $('.filePond').filepond('getFiles');
	$(files).each(function (index) {
		console.log(files[index].fileExtension);
	});

}

If there is an easier way to do this let me know. Thanks for creating this excellent plugin!

0reactions
rikschenninkcommented, Apr 5, 2021

@vovkandrew FilePond enhances the existing file input, so until the script loads, the original input will remain visible. Either load FilePond faster, or hide the original input until FilePond loads.

Will close the issue as the original question was resolved some time ago : )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kendo v2014.3.1119 - Upload - getFiles is not a function
getFiles()) });. I got the following error: Uncaught TypeError: hey.getFiles is not a function. I followed the example from here.
Read more >
FileSystemDirectoryEntry.getFile() - Web APIs - MDN Web Docs
An object which allows you to specify whether or not to create the entry if it's missing and if it's an error if...
Read more >
getFiles - API Reference - Kendo UI Upload - Documentation
Represents an Array collection of all currently selected files.
Read more >
How to check input file is empty or not using JavaScript/jQuery
Approach 1: Use element.files.length property to check file is selected or not. If element.files.length property returns 0 then the file is not ...
Read more >
Upload a file by using the REST API and jQuery
The jQuery(document).ready function checks for FileReader API ... FileReader) { alert('This browser does not support the FileReader API.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found