Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
File Upload: Add preview/summary for non-text files #826
As part of implementing the File Upload component in patternfly/patternfly-react#3865, I was asked how it could be used to upload a non-text file (specifically, a zip file). Since the component includes a textarea for the file contents, the only solution currently is to hide the textarea and provide no preview or summary for an uploaded non-text file, or to have the consumer implement their own custom preview or summary.
Initially I implemented a generic summary for non-text files that could be used by default, but I removed it before merging that PR so we could revisit its design and core implementation first. This is what my initial version looked like:
Basically, the idea is to show something useful based on only the data we know about a selected file before reading it: filename, type, size, and last modified date/time.