简体   繁体   English

在http链接上上传xml文件时,curl中出现“ PUT”错误

[英]`PUT` error in curl while uploading the xml file on http link

I want to upload a single .xml file on the http link. 我想在http链接上上传一个.xml文件。 For that now I am using curl to upload .xml file. 为此,我现在使用curl来上传.xml文件。

below is the curl command for uploading the file. 下面是用于上传文件的curl命令。

curl -i -X PUT -H "Content-Type: application/xml; charset=utf-8" -d @"/Desktop/upload_file.xml" http://website.name/

when I do this then there is error as below: 当我这样做时,会出现如下错误:

`HTTP/1.1 405 Method Not Allowed
Date: Sat, 25 Jul 2015 04:40:00 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 240
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL index.html.</p>
</body></html>`

So what is the main error/problem here? 那么,这里的主要错误/问题是什么? What does it mean requested method PUT is not allowed for the URL ? requested method PUT is not allowed for the URL什么意思? Is it error with website link or server configuration? 网站链接或服务器配置是否出错? or error with curl command which I passed? 还是我通过的curl命令出错?

Please give any solution or correction for it. 请给出任何解决方案或更正。

In simple word How can I upload a single .xml file on the website (http) in LINUX by use of C language? 简单来说,如何使用C语言在LINUX的网站(http)上上传单个.xml文件?

Thank you in advance. 先感谢您。

Regards Jaymin D 问候杰明D

This means Put method is not enabled on server.many server providers does not allow many methods by default for security purpose. 这意味着在服务器上未启用Put方法。出于安全目的,许多服务器提供程序默认情况下不允许使用许多方法。 I hope this questions will give you your answer. 希望这个问题能给您答案。

https://serverfault.com/questions/438183/how-to-enable-all-http-methods-in-an-apache-http-server https://serverfault.com/questions/438183/how-to-enable-all-http-methods-in-an-apache-http-server

How to enable and use HTTP PUT and DELETE with Apache2 and PHP? 如何在Apache2和PHP中启用和使用HTTP PUT和DELETE?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM