Comments (5)
Hello @einazare,
Thank you for this answer, I found a solution, here is my code:
imageUpload.jsx
handleImageChange(e) {
e.preventDefault();
let file = e.target.files[0];
let reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
this.setState({
file: file,
base64: reader.result
});
this.handleSubmit()
};
}
In this function the issue was reader.readAsDataURL(file)
(line 33). It has to be before the onloadend
. Then the reader.result
is the a base64 string of the file.
I hope I can help someone !
from ct-material-kit-pro-react.
Hello there, @Crael94 ,
Thank you for your interest in working with our products.
Sorry for this late response, since I am a Christian I've had some free days for the Easter Holiday:
- https://www.calendar-12.com/holidays/easter
- https://www.officeholidays.com/religious/orthodox/orthodox_easter.php
At the moment we haven't worked with back-end logic, and we do not really know how you would submit something to your back-end. This being said, without knowing I believe that the handleSubmit
should be called inside the reader.onloadend
function. Also, you should change the code inside the handleSubmit
function - it is a blank function, it doesn't do anything. And, since this is React that we are talking about, most definitely this function should have an Ajax call to a REST API. But once again, we are just front-end developers. There may be more to this.
Hope this will help.
All the best,
Manu
from ct-material-kit-pro-react.
Hello again, @Crael94 ,
I will leave this issue open. As you've said it, maybe it will help someone.
All the best,
Manu
from ct-material-kit-pro-react.
Thank you so much for your help
from ct-material-kit-pro-react.
@Crael94 this is great!, it works for me. very helpful.. thanks so much
from ct-material-kit-pro-react.
Related Issues (20)
- [Bug] Can't add files to React project. HOT 1
- [Bug] Second Ticket. Cannot Install @material-ui/core in existing project. HOT 1
- Got error on VERCEL HOT 1
- Does this kit support react 18? HOT 1
- Compile error on yarn install: from quick start guide HOT 1
- [Bug] Compile error on first starting the project files downloaded from my Creative Tim account HOT 1
- [Bug] Doesn't compile with npm 1.18 and react-script 5 and swiper 7 HOT 2
- [Bug] npm install is not running to my project which is not working. HOT 2
- [Bug] changeOnScroll HOT 1
- [Bug] Problem with ESLint HOT 1
- Component Header crashed HOT 1
- [Bug] Pages become unclickable after file change/recompile until they are manually refreshed in the browser. HOT 3
- Will be good to include documentation for the usage of different folders. e.g. pages vs layouts HOT 1
- [Bug] Rotating Card HOT 1
- [Bug] NPM install not working HOT 1
- Product I purchased doesn't work by default. HOT 2
- [Bug] npm install error HOT 2
- [Bug] material-kit-2-pro-react-v2.0.0 Fails on NPM Install HOT 11
- How to disable CustomDropDown HOT 1
- [Bug] How to disable CustomDropDown HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ct-material-kit-pro-react.