fileUpload object type of file

UI Components for React
Post Reply
chrishj
Posts: 200
Joined: 11 Jul 2011, 21:58

18 Sep 2022, 09:52

Hi,

I am using NextJs with Typescript.

Could you confirm the object type returned in event.files?
Could you also let me know the type of the onUpload event parameter?
I am looking to read the contents.

Code: Select all

<FileUpload
				name="edcStock"
				url="http://localhost:3000/secure/admin/upload-edc"
				onUpload={onUpload}
				accept="text/xml"
				maxFileSize={1000000}

/>

[const onUpload = async (event: any) => {
		console.log(event.files);
		const files = event.files;
		console.log(typeof files[0]);

		toast.current?.show({
			severity: 'info',
			summary: 'Uploaded',
			detail: 'EDC stock file uploaded',
			life: 3000,
		});
	};


/code]

Many thanks
PrimeReact: 8.4.0
NextJs: 12.2.5
Theme Apollo v7.0
Database pg 8.8.0

Melloware
Posts: 3299
Joined: 22 Apr 2013, 15:48

18 Sep 2022, 15:13

Just browse the FileUpload TypeScript def it has all the information you need.

https://github.com/primefaces/primereac ... pload.d.ts
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 11.0.3 / PF Extensions 11.0.3
PrimeReact 8.0.0

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests