fileUpload object type of file

UI Components for React
Post Reply
chrishj
Posts: 229
Joined: 11 Jul 2011, 21:58
Location: England, Lancashire
Contact:

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: 9.6.0
NextJs: 13.4.12
Theme Apollo v9.0
Database pg 8.8.0
react-hook-form: 7.38.0

Melloware
Posts: 3717
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 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: Charlestecak and 23 guests