Chris Iverson
Junior Member
There are many worlds, but they all share the same sky. One sky, one destiny.
Posts: 73
|
Post by Chris Iverson on Feb 17, 2008 12:56:17 GMT -5
|
|
|
Post by turbov21 on Feb 18, 2008 11:55:49 GMT -5
Yes...strangely, and I don't understand every part of the how, you can use a script to upload files to RBP. I don't know Liberty BASIC all that well, so I used Perl to get this: #!/usr/bin/perl -w
use Data::Dumper; use LWP::UserAgent; use HTML::TokeParser; use strict; use utf8; use warnings; use XML::Simple;
my $file = "C:\\andy\\73989.jpg";
my $url = "http://kerovia.net:8008/seaside/go/runbasic?app=UploadTest"; my $browser = LWP::UserAgent->new(); my $rbp = $browser->get($url);
unless ($rbp->is_success) { die "Could not get UploadTest\n\n" . $rbp->status_line; }
utf8::decode($rbp->content);
my $html = HTML::TokeParser->new(\$rbp->content); my %send = (); my $frmcnt = 0;
while (my $token = $html->get_token()) { if ($token) { if ($$token[0] eq "S") { if ($$token[1] eq "form") { $frmcnt++; } if ($$token[1] eq "input" && $frmcnt == 2) { if ($$token[2]->{name}) { $send{$$token[2]->{name}} = $$token[2]->{value}; } } } } }
my $upl = $browser->post($url, [ '1' => [$file], '_s' => $send{"_s"}, '_k' => $send{"_k"}, ], 'Content_Type' => 'form-data',);
print Dumper($upl);
As I said, I don't know all the how's and why's yet, but after you upload you file ($file) via the script, it returns with an HTTP 302 status, not the 200 status you need for the script to recognize a successful upload...but this does upload a file ($file) to my UploadList script.
|
|