节点js POST 请求multipart/form-data,如何更改名称属性

node js POST request multipart/form-data, how to change name attribute

我正在尝试通过带有请求 (https://github.com/request/request) 的 POST 请求上传照片或 休息者(https://github.com/danwrong/restler)

如果我想像这样上传照片到upload.php,如何设置输入名称属性(值)(名称="file")?

<form  action="upload.php" method="POST" enctype="multipart/form-data">
      <input type="file" name="file" >  <!-- <<<this   -->
      <input id="submit" name="submit" type="submit" value="upfile">
</form> 

the documentation 你链接到:

my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),

my_file是字段名。

这可能对你有帮助

    <form action="upload.php" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>

你也可以看到这个link.....

[http://www.w3schools.com/php/php_file_upload.asp][1]