We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Bad Fetch Error when submitting a recorded file...

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
tloring
Posts: 22
Joined: Sun Sep 07, 2003 3:51 pm

Bad Fetch Error when submitting a recorded file...

Post by tloring »

I receive an "a serious error of type: error bad fetch occurred. exiting" after a submit to my server. I do receive the file OK on my server.

I am wondering, is there some particular return content required?

I am submitting with the following tag:

<submit next="http://<host>/upload.php" method="post" name
list="final_recording"/>

The upload.php contains just the following:

<?
foreach ($_FILES as $file ) {
move_uploaded_file($file['tmp_name'], "/tmp/$file[name].raw");
}
?>

The return headers are:

HTTP/1.1 200 OK
Date: Tue, 09 Sep 2003 05:21:38 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_python/2.7.8 Python/1.5.2 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 mod_throttle/3.1.2
X-Powered-By: PHP/4.1.2
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html


Are the additional headers here any issue? Is there any particular content which is required or expected?

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR Bad Fetch Error on Submit of recording file

Post by support »

When submitting, the document being submitted to must return a valid voice XML document. Assume the following <submit> statement is used:

Code: Select all

<submit next="http://www.myhost.com/upload.php" method="post" namelist="final_recording"/> 

This would be an invalid page for upload.php:

Code: Select all

<?php 
foreach ($_FILES as $file ) { 
move_uploaded_file($file['tmp_name'], "/tmp/$file[name].raw"); 
} 
?> 
The preceding IVR example is invalid because it is not a valid voice XML document, so the IVR doesnt know what to do with it, and throws an error.badfetch

Here is a valid implementation of upload.php:

Code: Select all

<?php 

echo "<?xml=\"1.0\"?>";

foreach ($_FILES as $file ) { 
move_uploaded_file($file['tmp_name'], "/tmp/$file[name].raw"); 
} 
?>
<vxml version="2.0">
 <form id="myform">
 </form>
</vxml>
Last edited by support on Fri Feb 26, 2010 10:32 am, edited 3 times in total.

tloring
Posts: 22
Joined: Sun Sep 07, 2003 3:51 pm

Post by tloring »

Ok, that did the trick, thank you.

Post Reply