The parameters passed by ajax to the backend include both files and ordinary data

in a form form at the front desk

<form class="form-horizontal">
  <div class="form-group">
    <label for="imgurl" class="col-sm-2 control-label">:</label>
     <div class="col-sm-8">
        <input type="file" id="imgurl" style="float: left;">
    </div>
 </div>
<div class="form-group">
    <label for="showimg" class="col-sm-2 control-label"></label>
    <div class="col-sm-8">
        <div class="previewBox">
              <img id="showimg" style="width: 250px;height: 170px;">
        </div>      
        <br><br>
        <a class="btn btn-info cropBtn"></a>
    </div>
</div>
<div class="form-group">
    <label for="title" class="col-sm-2 control-label">:</label>
    <div class="col-sm-8">
       <input type="text" class="form-control" id="title" value=" 
        <%=articleData.title%>">
  </div>
</div></form>

the data sent to the background includes both files (pictures) and plain text data. How should entype be set? do you want to set one point? How should I pass the data in $.ajax ()? How does the backstage (node) accept it? What"s the general idea.

Mar.09,2021

put all the data in FormData and search for "ajax file upload".


https://codeshelper.com/a/11.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b368e6-2c006.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b368e6-2c006.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?