need help to debug fileupload for a given mutation

  • Status: Pending
  • Prize: ₹5000
  • Entries Received: 1

Contest Brief

I tried example ([login to view URL]) both api and app are working fine. I created my own client and tried and its not working. its sending null object to server.
What I need help in debug my client code provided as below pointing to the server([login to view URL]) and it should work
Since its sending null object so I am getting error "createReadStream is not a function" in both client and server. Would you pls help me to resolve this issue
Please find my my client code details and mutation details as follows(which need to work for a single file upload:
Here is my client .
import React from 'react';
import { useApolloClient, useMutation } from '@apollo/react-hooks'
import gql from 'graphql-tag'
const SINGLE_UPLOAD_MUTATION = gql`
mutation singleUpload($file: Upload!) {
singleUpload(file: $file) {
id
}
}
`
const UploadFile = () => {
const [uploadFile,{error}] = useMutation(SINGLE_UPLOAD_MUTATION);
const [uploadFileMutation] = useMutation(SINGLE_UPLOAD_MUTATION)
const onChange = ({
target: {
files: [file]
}
}) =>
uploadFileMutation({ variables: { file } }).then(() => {
[login to view URL]("file Uploade",file)
})
const onChangeHandle=(e)=>{
uploadFile({ variables: { file:[login to view URL][0] } })
}
return <input type="file" required onChange={onChangeHandle} />
}

export default UploadFile

Recommended Skills

Top entries from this contest

View More Entries

Public Clarification Board

No messages yet.

How to get started with contests

  • Post your contest

    Post Your Contest Quick and easy

  • Get tons of entries

    Get Tons of Entries From around the world

  • Award the best entry

    Award the best entry Download the files - Easy!

Post a Contest Now or Join us Today!