├── .gitignore ├── Lambda_Functions ├── NodeJS (UploadImage) │ └── Upload_To_S3_NodeJS.txt ├── Python (OCR) │ └── AWS_Textract_Python.txt └── RegEx_CheatSheet.txt ├── README.md ├── Sample.png ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.css ├── App.js ├── App.test.js ├── Upload.js ├── index.css ├── index.js ├── logo.svg ├── serviceWorker.js ├── setupTests.js └── upload.css └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /Lambda_Functions/NodeJS (UploadImage)/Upload_To_S3_NodeJS.txt: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | var s3 = new AWS.S3(); 3 | 4 | 5 | exports.handler = (event, context, callback) => { 6 | let recieved_request =JSON.stringify(event.img); 7 | let recieved_request_imageId =JSON.stringify(event.imageID); 8 | let recieved_request_ext =JSON.stringify(event.fileExt); 9 | let recieved_request_folder =JSON.stringify(event.folder); 10 | 11 | recieved_request= recieved_request.slice(1, -1); 12 | var filePath = recieved_request_imageId + "." + recieved_request_ext.replace('"','').replace('"',''); 13 | let buffer = Buffer.from(recieved_request.replace(/^data:image\/\w+;base64,/, ""),'base64'); 14 | 15 | 16 | var params = { 17 | Key: filePath, 18 | Body: buffer, 19 | ContentEncoding: 'base64', 20 | ContentType: 'image/jpeg', 21 | Bucket: "YOUR_BUCKET_NAME" 22 | }; 23 | 24 | 25 | 26 | s3.upload(params, function(err, data){ 27 | if(err) { 28 | callback(err, null); 29 | } else { 30 | var res ={ 31 | "statusCode": 200, 32 | "headers": { 33 | "Content-Type": "application/json" 34 | } 35 | }; 36 | res.body = "Uploaded"; 37 | callback(null, res); 38 | } 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /Lambda_Functions/Python (OCR)/AWS_Textract_Python.txt: -------------------------------------------------------------------------------- 1 | import json 2 | import boto3 3 | import re 4 | 5 | 6 | def lambda_handler(event, context): 7 | filePath= event; 8 | bad_chars = [';', ':', '!', "*", ']', "[" ,'"', "{" , "}" , "'",","] 9 | 10 | s3BucketName = "YOUR_BUCKET_NAME" 11 | documentName = filePath 12 | textract = boto3.client('textract') 13 | 14 | # Call Amazon Textract 15 | response = textract.detect_document_text( 16 | Document={ 17 | 'S3Object': { 18 | 'Bucket': s3BucketName, 19 | 'Name': documentName 20 | } 21 | }) 22 | 23 | result=[] 24 | processedResult="" 25 | for item in response["Blocks"]: 26 | if item["BlockType"] == "WORD": 27 | result.append(item["Text"]) 28 | element = item["Text"] + " " 29 | processedResult += element 30 | 31 | print (processedResult) 32 | res=[] 33 | amount="" 34 | 35 | str_Amount= str(re.findall('(?i)[invoice total|amount|total|balance]\s*?[due|amount]*\s*[$]\d{1,10}[.]\d{0,2}',processedResult)) 36 | amount= str(re.findall('\$[^\]]+',str_Amount)) 37 | 38 | 39 | 40 | amount = str(amount.split(' ')[-1]) 41 | 42 | for i in bad_chars : 43 | amount = amount.replace(i, '') 44 | 45 | 46 | if len(amount)>0 : 47 | res.append(str(amount)) 48 | else: 49 | res.append('') 50 | 51 | 52 | 53 | #Extracting invoice number and removing the bad characters 54 | 55 | str_Invoice = str(re.findall('(?i)invoice\s*[#|number|num]+[\s][\d|\w|_,-|A-Za-z]+',processedResult)) 56 | result = str(str_Invoice.split(' ')[-1]) 57 | 58 | if "IN" not in result: 59 | str_Invoice = str(re.findall('(?i)IN[V]*[0-9]*',processedResult)) 60 | result = str(str_Invoice.split(' ')[-1]) 61 | 62 | 63 | for bad_char in bad_chars : 64 | result = result.replace(bad_char, '') 65 | 66 | if len(result) >0 : 67 | res.append(result) 68 | else: 69 | res.append('') 70 | 71 | 72 | 73 | str_InvoiceDate=str(re.findall('(?i)invoice\s*date\s*\d{1,2}?.\d{1,2}?.\d{1,4}',processedResult)) 74 | print (str_InvoiceDate) 75 | try: 76 | str_InvoiceDate = str(str_InvoiceDate.split(' ')[-1]) 77 | except: 78 | pass 79 | 80 | 81 | if len(str_InvoiceDate)<=2 : 82 | str_InvoiceDate=str(re.findall('(\d+[-/]\d+[-/]\d+)',processedResult)) 83 | try: 84 | str_InvoiceDate = str(str_InvoiceDate.split(' ')[1]) 85 | except: 86 | pass 87 | 88 | try: 89 | for i in bad_chars : 90 | str_InvoiceDate = str_InvoiceDate.replace(i, '') 91 | except: 92 | pass 93 | 94 | 95 | if len(str_InvoiceDate)>0 : 96 | res.append(str_InvoiceDate) 97 | else: 98 | res.append('') 99 | 100 | 101 | return { 102 | 'statusCode': 200, 103 | #'body': JSON.stringify(result) 104 | 'body': res 105 | 106 | } 107 | -------------------------------------------------------------------------------- /Lambda_Functions/RegEx_CheatSheet.txt: -------------------------------------------------------------------------------- 1 | . - Any Character Except New Line 2 | \d - Digit (0-9) 3 | \D - Not a Digit (0-9) 4 | \w - Word (a-z, A-Z, 0-9, _) 5 | \W - Not a Word 6 | \s - Whitespace (space, tab, newline) 7 | \S - Not Whitespace (space, tab, newline) 8 | 9 | $ - End of a String 10 | \b - Word Boundary 11 | \B - Not a Word Boundary 12 | ^ - Beginning of a String 13 | 14 | 15 | ( ) - Group 16 | [] - Matches Characters 17 | [^ ] - Matches Characters NOT in brackets 18 | | - Either Or 19 | 20 | 21 | Quantifiers: 22 | 23 | + - 1 or More 24 | * - 0 or More 25 | ? - 0 or One 26 | {3} - Exact Number 27 | {3,4} - Range of Numbers (Minimum, Maximum) 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### `Real Time OCR Web App (React, NodeJS, Python and AWS)` 2 | 3 | Developed by : CodeEngine 4 | https://www.youtube.com/CodeEngine 5 | 6 | You can find the lambda functions in "Lambda_Functions" folder. 7 | 8 | In the project directory, you can run: 9 | 10 | ### `npm install` 11 | 12 | ### `npm start` 13 | 14 | 15 | Runs the app in the development mode.
16 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 17 | 18 | The page will reload if you make edits.
19 | You will also see any lint errors in the console. 20 | 21 | ### `npm build` 22 | 23 | Builds the app for production to the `build` folder.
24 | It correctly bundles React in production mode and optimizes the build for the best performance. 25 | -------------------------------------------------------------------------------- /Sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeEngineTechnology/OCR_WebApp/02d5c476de907380052bc5206366d69d99f11f26/Sample.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@fortawesome/fontawesome-svg-core": "^1.2.25", 7 | "@fortawesome/free-solid-svg-icons": "^5.11.2", 8 | "@fortawesome/react-fontawesome": "^0.1.8", 9 | "@testing-library/jest-dom": "^4.2.4", 10 | "@testing-library/react": "^9.3.2", 11 | "@testing-library/user-event": "^7.1.2", 12 | "base64-img": "^1.0.4", 13 | "dotenv": "^8.2.0", 14 | "moment": "^2.24.0", 15 | "react": "^16.12.0", 16 | "react-dom": "^16.12.0", 17 | "react-file-base64": "^1.0.3", 18 | "react-moment": "^0.9.6", 19 | "react-scripts": "3.3.0", 20 | "reactstrap": "^8.2.0" 21 | }, 22 | "scripts": { 23 | "start": "react-scripts start", 24 | "build": "react-scripts build", 25 | "test": "react-scripts test", 26 | "eject": "react-scripts eject" 27 | }, 28 | "eslintConfig": { 29 | "extends": "react-app" 30 | }, 31 | "browserslist": { 32 | "production": [ 33 | ">0.2%", 34 | "not dead", 35 | "not op_mini all" 36 | ], 37 | "development": [ 38 | "last 1 chrome version", 39 | "last 1 firefox version", 40 | "last 1 safari version" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeEngineTechnology/OCR_WebApp/02d5c476de907380052bc5206366d69d99f11f26/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeEngineTechnology/OCR_WebApp/02d5c476de907380052bc5206366d69d99f11f26/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeEngineTechnology/OCR_WebApp/02d5c476de907380052bc5206366d69d99f11f26/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | 5 | function App() { 6 | return ( 7 |
8 |
9 | logo 10 |

11 | Welcome to my pag1! 12 |

13 | 19 | 20 | 21 |
22 |
23 | ); 24 | } 25 | 26 | export default App; 27 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /src/Upload.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import FileBase64 from 'react-file-base64'; 3 | import {Button,Form,FormGroup,Label,FormText,Input} from "reactstrap"; 4 | 5 | import "./upload.css"; 6 | 7 | 8 | class Upload extends Component { 9 | 10 | constructor(props){ 11 | super(props); 12 | 13 | 14 | this.state = { 15 | confirmation : "", 16 | isLoading : "", 17 | files : "", 18 | Invoice : "", 19 | Amount : "", 20 | InvoiceDate: "", 21 | Vendor : "", 22 | Description : "" 23 | } 24 | 25 | this.handleChane= this.handleChane.bind(this); 26 | 27 | } 28 | 29 | 30 | handleChane(event){ 31 | event.preventDefault(); 32 | const target = event.target; 33 | const value=target.value; 34 | const name=target.name; 35 | 36 | this.setState({name:value}); 37 | 38 | } 39 | 40 | async handleSubmit(event){ 41 | event.preventDefaulr(); 42 | this.setState({confirmation : "Uploading..."}); 43 | 44 | } 45 | 46 | async getFiles(files){ 47 | this.setState({ 48 | isLoading : "Extracting data", 49 | files : files 50 | }); 51 | 52 | 53 | const UID= Math.round(1+ Math.random() * (1000000-1)); 54 | 55 | var date={ 56 | fileExt:"png", 57 | imageID: UID, 58 | folder:UID, 59 | img : this.state.files[0].base64 60 | }; 61 | 62 | this.setState({confirmation : "Processing..."}) 63 | await fetch( 64 | 'https://31gv9av7oe.execute-api.us-west-1.amazonaws.com/Production', 65 | { 66 | method: "POST", 67 | headers: { 68 | Accept : "application/json", 69 | "Content-Type": "application.json" 70 | }, 71 | body : JSON.stringify(date) 72 | } 73 | ); 74 | 75 | 76 | 77 | let targetImage= UID + ".png"; 78 | const response=await fetch( 79 | 'https://31gv9av7oe.execute-api.us-west-1.amazonaws.com/Production/ocr', 80 | { 81 | method: "POST", 82 | headers: { 83 | Accept : "application/json", 84 | "Content-Type": "application.json" 85 | }, 86 | body : JSON.stringify(targetImage) 87 | 88 | } 89 | 90 | ); 91 | this.setState({confirmation : ""}) 92 | 93 | const OCRBody = await response.json(); 94 | console.log("OCRBody",OCRBody); 95 | 96 | this.setState({Amount :OCRBody.body[0] }) 97 | this.setState({Invoice :OCRBody.body[1] }) 98 | this.setState({InvoiceDate :OCRBody.body[2] }) 99 | 100 | 101 | } 102 | 103 | render() { 104 | const processing=this.state.confirmation; 105 | return ( 106 |
107 |
108 |
109 | 110 |

{processing}

111 |
Upload Invoice
112 | PNG,JPG 113 | 114 | 115 |
116 | 119 | 120 |
121 |
122 | 123 | 124 | 127 | 135 | 136 | 137 | 138 | 139 | 140 | 143 | 151 | 152 | 153 | 154 | 155 | 156 | 159 | 167 | 168 | 169 | 170 | 171 | 174 | 182 | 183 | 184 | 185 | 188 | 196 | 197 | 200 |
201 |
202 |
203 | ); 204 | } 205 | } 206 | 207 | export default Upload; -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import Upload from './Upload'; 5 | import * as serviceWorker from './serviceWorker'; 6 | import "bootstrap/dist/css/bootstrap.css"; 7 | 8 | ReactDOM.render(, document.getElementById('root')); 9 | 10 | // If you want your app to work offline and load faster, you can change 11 | // unregister() to register() below. Note this comes with some pitfalls. 12 | // Learn more about service workers: https://bit.ly/CRA-PWA 13 | serviceWorker.unregister(); 14 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl, { 104 | headers: { 'Service-Worker': 'script' } 105 | }) 106 | .then(response => { 107 | // Ensure service worker exists, and that we really are getting a JS file. 108 | const contentType = response.headers.get('content-type'); 109 | if ( 110 | response.status === 404 || 111 | (contentType != null && contentType.indexOf('javascript') === -1) 112 | ) { 113 | // No service worker found. Probably a different app. Reload the page. 114 | navigator.serviceWorker.ready.then(registration => { 115 | registration.unregister().then(() => { 116 | window.location.reload(); 117 | }); 118 | }); 119 | } else { 120 | // Service worker found. Proceed as normal. 121 | registerValidSW(swUrl, config); 122 | } 123 | }) 124 | .catch(() => { 125 | console.log( 126 | 'No internet connection found. App is running in offline mode.' 127 | ); 128 | }); 129 | } 130 | 131 | export function unregister() { 132 | if ('serviceWorker' in navigator) { 133 | navigator.serviceWorker.ready.then(registration => { 134 | registration.unregister(); 135 | }); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /src/upload.css: -------------------------------------------------------------------------------- 1 | .files input { 2 | outline: 2px dashed #92b0b3; 3 | outline-offset: -10px; 4 | -webkit-transition: outline-offset .15s ease-in-out, background-color .15s linear; 5 | transition: outline-offset .15s ease-in-out, background-color .15s linear; 6 | padding: 120px 0px 85px 35%; 7 | text-align: center !important; 8 | margin: 0; 9 | width: 100% !important; 10 | } 11 | 12 | .files input:focus { 13 | outline: 2px dashed #92b0b3; 14 | outline-offset: -10px; 15 | -webkit-transition: outline-offset .15s ease-in-out, background-color .15s linear; 16 | transition: outline-offset .15s ease-in-out, background-color .15s linear; 17 | border: 1px solid #92b0b3; 18 | } 19 | 20 | .files { 21 | position: relative 22 | } 23 | 24 | .files:after { 25 | pointer-events: none; 26 | position: absolute; 27 | top: 60px; 28 | left: 0; 29 | width: 50px; 30 | right: 0; 31 | height: 56px; 32 | content: ""; 33 | background-image: url(https://image.flaticon.com/icons/png/128/109/109612.png); 34 | display: block; 35 | margin: 0 auto; 36 | background-size: 100%; 37 | background-repeat: no-repeat; 38 | } 39 | 40 | .color input { 41 | background-color: #f1f1f1; 42 | } 43 | 44 | .files:before { 45 | position: absolute; 46 | bottom: 10px; 47 | left: 0; 48 | pointer-events: none; 49 | width: 100%; 50 | right: 0; 51 | height: 57px; 52 | content: " or drag it here. "; 53 | display: block; 54 | margin: 0 auto; 55 | color: #2ea591; 56 | font-weight: 600; 57 | text-transform: capitalize; 58 | text-align: center; 59 | } --------------------------------------------------------------------------------