import React, { useState } from 'react';
const FileUpload = () => {
const [file, setFile] = useState(null);
const handleFileChange = (e) => {
const selectedFile = e.target.files[0]; // Get the selected file
setFile(selectedFile); // Store the file in state
};
return (
<div>
<input type="file" onChange={handleFileChange} />
{file && (
<div>
<h3>Selected File:</h3>
<p>Name: {file.name}</p>
<p>Size: {file.size} bytes</p>
<p>Type: {file.type}</p>
</div>
)}
</div>
);
};
export default FileUpload;
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)