{"id":18614839,"url":"https://github.com/andrewjbateman/react-file-upload","last_synced_at":"2025-04-11T00:30:59.618Z","repository":{"id":42713867,"uuid":"160968694","full_name":"AndrewJBateman/react-file-upload","owner":"AndrewJBateman","description":":clipboard:  Express backend server app to handle file uploads","archived":false,"fork":false,"pushed_at":"2023-03-14T22:29:15.000Z","size":4736,"stargazers_count":4,"open_issues_count":10,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T06:51:15.641Z","etag":null,"topics":["api-server","express","full-stack","nodejs","react","typescript","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewJBateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-08T18:46:35.000Z","updated_at":"2022-08-11T12:38:20.000Z","dependencies_parsed_at":"2023-02-18T10:45:38.008Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/react-file-upload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Freact-file-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Freact-file-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Freact-file-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Freact-file-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/react-file-upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322230,"owners_count":21084333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-server","express","full-stack","nodejs","react","typescript","vscode-extension"],"created_at":"2024-11-07T03:27:10.104Z","updated_at":"2025-04-11T00:30:54.607Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React File Upload\n\n* React frontend image upload with express backend server.js to handle file uploads.\n* This is an excellent tutorial by [Traversy Media](http://www.traversymedia.com).\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/react-file-upload?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/react-file-upload?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/react-file-upload?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/react-file-upload?style=plastic)\n\n## Table of contents\n\n* [React File Upload](#react-file-upload)\n  * [Table of contents](#table-of-contents)\n  * [General info](#general-info)\n  * [Screenshots](#screenshots)\n  * [Technologies](#technologies)\n  * [Fullstack Dev Setup](#fullstack-dev-setup)\n  * [Code Examples](#code-examples)\n  * [Status \u0026 To-Do List](#status--to-do-list)\n  * [Inspiration](#inspiration)\n  * [:file_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## General info\n\n* Uploads an image file from the React frontend. This file is fetched by the backend using express.js and stored in 'uploads' in the public folder.\n* The frontend uses a FileUpload component with a [FormData object](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) with inputs for the file itself and a file name. The image will be displayed on the frontend.\n* Includes a % upload complete progress-bar component.\n* Includes a dismissable status message component.\n* [React hooks](https://reactjs.org/docs/hooks-overview.html#state-hook) used to write state. React extension shows hooks and their states in the dev console.\n\n## Screenshots\n\n![Example screenshot](./img/screen-shot.png).\n\n## Technologies\n\n* [Node.js v14](https://nodejs.org/) javascript runtime using the [Chrome V8 engine](https://v8.dev/)\n* [Express middleware v4](https://expressjs.com/)\n* [Express fileupload middleware v1](https://www.npmjs.com/package/express-fileupload)\n* [React v16](https://reactjs.org/) Frontend javascript library.\n* [Bootstrap front-end component library](https://getbootstrap.com/)\n* [Font Awesome icons](https://fontawesome.com/)\n* [React Hooks](https://reactjs.org/docs/hooks-overview.html#state-hook)\n\n## Fullstack Dev Setup\n\n* `npm run dev` runs the front and backend simultaneously in development mode. It will open [http://localhost:3000](http://localhost:3000) to view in browser. Any code changes will automatically reload the browser.\n\n## Code Examples\n\n* FileUpload component try-catch to show percentage progress or error message.\n\n```javascript\n    try {\n      const res = await axios.post('/upload', formData, {\n        headers: {\n          'Content-Type': 'multipart/form-data'\n        },\n        onUploadProgress: progressEvent =\u003e {\n          setUploadPercentage(parseInt(Math.round((progressEvent.loaded * 100) / progressEvent.total)));\n          setTimeout(() =\u003e setUploadPercentage(0), 10000);\n        }\n      });\n\n      const { fileName, filePath } = res.data;\n      setUploadedFile({ fileName, filePath });\n      setMessage('File uploaded');\n    } catch(err) {\n      if(err.response.status === 500) {\n        setMessage('There was a problem with the server');\n      } else {\n        setMessage(err.response.data.msg);\n      }\n    }\n```\n\n## Status \u0026 To-Do List\n\n* Status: Working.\n* To do: Nothing\n\n## Inspiration\n\n* [Traversy Media: React File Uploader With Express (Using React Hooks)](https://www.youtube.com/watch?v=b6Oe2puTdMQ)\n\n## :file_folder: License\n\n* This project is licensed under the terms of the MIT license.\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Freact-file-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Freact-file-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Freact-file-upload/lists"}