如何使用CURL / CygWin从本地Windows机器发送文件到服务器? [英] How to use CURL/CygWin to send files from local Windows machine to Server?

查看:866
本文介绍了如何使用CURL / CygWin从本地Windows机器发送文件到服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是使用cygwin / curl将CouchDB文档从我的Windows机器上传到远程服务器。

My goal is to upload a CouchDB document from my Windows machine to a remote server using cygwin/curl.

这里是一个教程,在Mac上:
http://net.tutsplus.com/ tutorials / getting-started-couchdb /

Here is a tutorial that shows how to do the same on a Mac: http://net.tutsplus.com/tutorials/getting-started-with-couchdb/


curl -X POST http://127.0.0.1:5984/mycouchshop/ -d @ person.json -HContent-Type:application / json

curl -X POST http://127.0.0.1:5984/mycouchshop/ -d @person.json -H "Content-Type: application/json

如何在Windows和CygWin中执行相同的操作?

How can I do the same with Windows & CygWin?

推荐答案

打开cygwin后

步骤1 - 光盘插入到您要通过CURL发布的文件的目录:

step 1 - CD into the directory that contains the file you would like to post via CURL:

cd ../
cd /cygdrive/c/Users/[put user name here]/Documents/[more directories here]/

注意:奇怪的部分是必须通过 cygdrive目录。

第2步 - 使用CURL发送文件:

step 2 - Use CURL to send the file:

curl -X POST http://mywebsite.com/path/ to / directory -d @ some_file.extension -HContent-Type:application / json

curl -X POST http://mywebsite.com/path/to/directory -d @some_file.extension -H "Content-Type: application/json"

com ...,some_file.extension和application / json替换为实际值。

Replace "mywebsite.com...", "some_file.extension" and "application/json" with actual values.

这篇关于如何使用CURL / CygWin从本地Windows机器发送文件到服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆