ot: need help with saving a file via http

Vortek, Eater of Souls! vortek at the-bofh.com
Wed Jul 30 10:11:57 EDT 2003


Hello,
Sorry for the off-topic message, but I've been searching for a cgi
script, or other program to allow me to save a file via the http post
method.
I've found several such scripts, but all require some form of password
authentication.
I'm using a VXML platform (Tellme) to try and record a message, and save
it to my server.
This of course, rules out any script that requires any form of login as
the VXML script can't handle that.
I was wondering if someone on the list knows perl, php, or some other
web language and could wip me up a quick script, or correct the attached
one.
every time I run it, I get an "inappropriate IOCTL for device" error.
it's a sample script that I got off the Tellme website, and I'm no great
shakes at perl.
Any help anyone could render would be greatly appriciated.

Jim

#!/usr/bin/perl -w
# Need CGI.pm module.
# See http://stein.cshl.org/WWW/software/CGI/cgi_docs.html for usage.
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard :html3);
my $oReq = new CGI();
print "Content-Type: text/xml\n\n";
my $bSuccess = 1;
my $msg = "";
# grab recording from "personal_greeting" param.
my $recording = $oReq->param("personal_greeting");
# grab user id from uid param.
my $uid = $oReq->param("uid");
# save recording to file named after user's id
my $outfile = "$uid.wav";
$! = 0; # clear i/o errs
open(OUT, ">$outfile");
if ($! != 0)
{
$bSuccess = 0;
$msg = $!;
}
else
{
while (<$recording>)
{
print OUT $_;
}
close(OUT);
}
WriteSubdialog($bSuccess, $msg);
# write back to the VoiceXML interpreter
sub WriteSubdialog
{
my ($code) = @_;
print <<EOF;
<vxml version="2.0">
<var name="code" expr="$code"/>
<var name="msg" expr="'$msg'"/>
<form>
<block>
<return namelist="code msg"/>
</block>
</form>
</vxml>
EOF
}






More information about the Speakup mailing list