Skip to content

Instantly share code, notes, and snippets.

@frhan
Created May 8, 2025 13:35
Show Gist options
  • Select an option

  • Save frhan/6b76679330fae3747949736b4b5809d3 to your computer and use it in GitHub Desktop.

Select an option

Save frhan/6b76679330fae3747949736b4b5809d3 to your computer and use it in GitHub Desktop.
react-1
Task: Build a Secure File Upload Component
Objective:
Create a reusable React component for secure file upload with the following features:
File Preview: Show a thumbnail preview for images and file icons for other types.
File Size Limit: Enforce a 10 MB file size limit with a clear error message.
Drag and Drop Support: Allow users to drag and drop files.
Progress Indicator: Show upload progress with a loading bar.
Secure Upload: Encrypt the file using AES-256 before sending it to the server.
Responsive Design: Ensure the component is mobile-friendly.
API Integration:
User Feedback: Provide user feedback on success or error states.
Technical Requirements:
Use Tailwind CSS for styling.
Implement AES encryption using a secure library like crypto-js.
Use React hooks (e.g., useState, useEffect) for state management.
Follow best practices for security and performance.
Deliverables:
Source code for the component (FileUpload.js and FileUpload.css).
Basic integration guide for connecting to the backend API.
Unit tests covering key scenarios.
Demo page for testing the component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment