function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
da2nada2na 

remoteFunction (multipart/form-data) - Read timed out

The AJAX Proxy remoteFunction fails when posting multipart/form-data. This may be related to a previousily reported bug: Bug #192181

 

Here is the remoteFunction code:

function uploadTest(){

var content = '--7777777';
content += '\r\nContent-Disposition: form-data; name="file"; filename="test.txt"';
content += '\r\nContent-Type: text/plain';
content += '\r\n\r\n Test Test Test';
content += '\r\n--7777777--';

sforce.connection.remoteFunction({
url: 'http://test.com',
requestHeaders:{
"Content-Type": "multipart/form-data; boundary=7777777"
},
requestData: content,
method: "POST",
onSuccess : function(response) {
alert("Success: " + response);
},
onFailure : function(response) {
alert("Failure: " + response);
}
});
}

 

And, here is the response:

<html>
<head><title>400 Unable to forward request due to: Read timed out</title></head>
<body>
<h1>400 Unable to forward request due to: Read timed out</h1>
<p /><hr />
<small>

</small>
</body></html>

 

When the remoteFunction method is changed to GET, the request is successfully sent to the host without the requestData.  A possible solution may be to allow the sending of requestData with a GET method or allowing multipart/form-data to be set as the Content-Type in requestHeaders.

 

Note: Sending the same request with an Apex HttpRequest works perfectly.  However, the 100kb size limit makes it a non-viable solution.

 

Any assistance in getting the remoteFunction to work properly would be greatly appreciated!

 

-Thanks

 

 

 

 

gv007gv007
where are you uploading the documents ?.Can you explain elaborately.
da2nada2na

...the files are being uploaded to a rest(ful) web service that returns XML in its response.  The issue I'm having is that the request is never made to the host (not leaving s/f) - I get a "Read timed out" error.  I'm thinking this might be a bug within the AJAX Proxy remoteFunction that is causing the request to fail?

TebodaTeboda
I'm also seeing this issue, any news on this?
Message Edited by Teboda on 04-16-2009 01:17 AM
PamSalesforcePamSalesforce

Hi,

Can you post the code for to send(multipart/form-data) using HttpRequest.

 

Thanks,


 

panipani

Any solution on this so far. We can make calls for other services expect upload part, which is working in plain javascript ajax proxy or tools like postman (chrome extension). 

We are trying to upload multiple files to Alfresco DMS from a visualforce page through client browser using javascript/html5. So any help is really appreciate.