xml - Translate PHP PUT HTTP request to ColdFusion

Solution:
I would try adding method="put" to your cfhttp call. That will make CFHTTP send the correct http verb (PUT in this case).
Answer
Solution:
Here's Java spark (from Java docs), you need to work it out:
PutMethod put = new PutMethod("http://jakarta.apache.org");
put.setRequestBody(new FileInputStream("UploadMe.gif"));
is translated in CF like this:
<cfset myPut = createObject("java", "org.apache.commons.httpclient.methods.PutMethod") />
<cfset myPut.init("http://example.com") />
<cfset myInputStream = createObject("java", "java.io.FileInputStream") />
<cfset myInputStream.init("myxml.xml") />
<cfset myPut.setRequestBody(myInputStream) />
And so on...
In link I pasted above you can see somehting like this:
URL url = new URL("http://www.example.com/resource");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestMethod("PUT");
OutputStreamWriter out = new OutputStreamWriter(
httpCon.getOutputStream());
out.write("Resource content");
out.close();
Find working Java soution and translate it in CF.
EDIT:
See comments below for a solution.
Answer
Solution:
Assuming you are doing a PUT method, you can use ColdFusion's GetHttpRequestData() function to obtain the XHR data.
You can then save it out by doing something like this:
<cfset xhr_data = GetHttpRequestData() />
<cffile action="write" file="PATH/FILENAME" output="#xhr_data.content#">
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: a non-numeric value encountered in
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.