1

I want to upload a single .xml file on the http link. For that now I am using curl to upload .xml file.

below is the curl command for uploading the file.

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? Is it error with website link or server configuration? or error with curl command which I passed?

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?

Thank you in advance.

Regards Jaymin D

secure
  • 107
  • 9

1 Answers1

1

This means Put method is not enabled on server.many server providers does not allow many methods by default for security purpose. 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

How to enable and use HTTP PUT and DELETE with Apache2 and PHP?

Community
  • 1
  • 1
Vishal Patel
  • 1,715
  • 16
  • 26
  • Thanks Vishal for quick response. Is there any way to check that PUT service is enabled/disabled on my website. Because I brought domain name from some 'abc' company with some space and hosting, so how can I check this in my website database? And very basic question, Is there any method to upload a `.xml` file on HTTP website in Linux ? I am newbie about it and I found `wget` and `curl` but I read that curl is good for uploading file on website data base using `C` language. Please help me regarding this issue. – secure Jul 25 '15 at 06:50
  • it is good if you ask about it to hosting provider and it is enbled from `apache.conf`. your hosting may be shared hosting so you have not rights view as well as for modify `apache.conf`.so ask it to your hosting provider for this. – Vishal Patel Jul 25 '15 at 07:10
  • Thanks for suggestion, I will contact to my hosting provide and inform this issue. Will post update information here. Regards Jaymin D – secure Jul 27 '15 at 08:38