score:1
Accepted answer
i can't catch images on my react application. also i cant get arrays fields.
to achieve your requirement of posting data with file(s) and make the data can be bound to action parameter well, you need to do following modifications:
1)a parameterless constructor for class apirequest
[datacontract(name = "api-request"), serializable]
public class apirequest<t>
{
public apirequest()
{
}
public apirequest(t data, byte[] token)
{
//...
note: this doc shows deserialization behavior within system.text.json
2)dynamically generate and populate formdata like below
const data = new formdata();
//...
data.append('language', language_here);
//...
data.append('data.unitstock', unitstock_here);
data.append('data.productimages', productimage1_here);
data.append('data.productimages', productimage2_here);
//...
note: this doc explains what model binding is and how it works
3)to bind byte[]
data, you may need to use the bytearraymodelbinder
test result
Source: stackoverflow.com
Related Query
- Image and Array Fields Send Null on React JS
- Setting an array to null and then updating it in useEffect React
- How to validate the form and send user to another page on successful data filled in form fields in React JS?
- How to check if the array of object is null using react and javascript?
- Splitting an array of info to send request and receive info properly React JavaScript
- how to store textarea new line value into array with react and send it to node js variable with post request
- Retrieve row value selected in a Table as an array and send the results to another function on React
- How Can i send image and text user information in react js
- Toggling between an image grid and image slider with one array of images in react hooks
- Display both image and text from array of objects in React
- Cannot send null to state in order to make ImageField change to null in React and Django
- How to display the image and background image from the array in react
- Filter out null and empty values from JSON array in react
- Send an image from react to flask and return the ocr value back to react
- How to send a form input data containing both image and text from React front-end to Express backend using Multer
- How to send array of objects data from child component to parent component and store in the parent object using react hooks?
- How to set image width to be 100% and height to be auto in react native?
- Sort an array of objects in React and render them
- How do I store JWT and send them with every request using react
- Typescript and React setting initial state with empty typed array
- Can I send an AJAX call in React and Redux without action creators and reducers?
- React Iterate and insert components based on count of array
- React and Multiple form fields
- React TransitionGroup and React.cloneElement do not send updated props
- Trying to get then send a cookie using react and fetch
- React component returning cannot read property '__reactInternalInstance$ of null after trying to access array
- Auto save form fields in react and redux
- How do I use React and forms to get an array of checked checkbox values?
- React Typescript how send props and use it in child component
- RxJS and React multiple clicked elements to form single data array
More Query from same tag
- How to get the origin of current URL using react-router-dom?
- How can I save application state to cookies
- Submitting form from parent component
- React useEffect renders change on 2nd click?
- Every new Item added displays the same Date-Time
- Dynamically import language json file for react / react-intl
- Unable to render html tags that were returned by the server dynamically
- React big calendar not instantly loading
- this.props.match.params passed into child component after authorisation
- How to convert a container having three rows and three column into four rows and two columns
- What can't be done without useEffect hook?
- React: add HTML from generic file path at server-side build time
- How to properly use clearInterval in this function?
- Any way to use immutable.js with lodash?
- Devide list from database into multiple section (React)
- How to open the next page on click mouse
- Click outside of the div
- react typescript issue on addEvenListener
- Typescript Error: Argument of type 'NodeListOf<HTMLInputElement> | undefined' is not assignable to parameter of type 'Iterable<HTMLInputElement> ..."
- useDebugValue not Displayed
- React set multiple defaultValue to test input
- React list with no keys
- How to create a dynamic routing naming the routes based on props of a component in react-router-dom
- How to set border radius ant design
- How to transfer data between two child component in react js?
- React Firebase update components without refresh
- Creating child elements via Props in React.createElement
- React: Does it make sense to pass the whole state to another component?
- reactjs - Import a dynamic file in render() method
- I have a TypeError in React and my app won't load because of this error