GithubHelp home page GithubHelp logo

Comments (5)

Aman-zishan avatar Aman-zishan commented on May 22, 2024 9

@biswasjishnu @tofu00 I just reached at this bug, the problem was while passing selectedFile from client side it was in object type , we mentioned it to be String in backend.

The solution is to get only the base64 field from frontend data and then POST the request. In order to do that you just have to change the onDone in Forms.js like this.

Screenshot (199)

from project_mern_memories.

CTZxVULKAN avatar CTZxVULKAN commented on May 22, 2024

I am having the same issue. I even cloned the repo and ran the code stilll the same issue.
It worked on the video though.

from project_mern_memories.

CTZxVULKAN avatar CTZxVULKAN commented on May 22, 2024

@Aman-zishan Thanks i will try this out as soon as possible.

from project_mern_memories.

techay-mihir avatar techay-mihir commented on May 22, 2024

@biswasjishnu @tofu00 I just reached at this bug, the problem was while passing selectedFile from client side it was in object type , we mentioned it to be String in backend.

The solution is to get only the base64 field from frontend data and then POST the request. In order to do that you just have to change the onDone in Forms.js like this.

Screenshot (199)

when i use this i got error like file not found what should i do now ?

from project_mern_memories.

CTZxVULKAN avatar CTZxVULKAN commented on May 22, 2024

@techy-mit Could you please be more specific with the issue you are having.
Make sure SelectedFile is defined in your schema
Use this for reference ->

Code in formjs

    <div className={`${classes.root} ${classes.fileInput}`}>
      <FileBase
        type="file"
        multiple={false}
        onDone={(file) => setItemData({...itemData, itemScreenshot: file.base64})} />
    </div>

Code for the schema

import mongoose from 'mongoose';

const itemSchema = mongoose.Schema({
  itemScreenshot: String,
});

const ItemInfo = mongoose.model('ItemInfo', itemSchema);
export default ItemInfo;

Without specific details i cannot help more, you should cross check your actions, reducers, api and the proxy u made in package.json in the client side. The error should lie in one of these places.

from project_mern_memories.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.