A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Problem getting info from MX to CGI, HELP!

  1. #1
    When I send information to my cgi script, it can't read it properly. For example: I send "file=../home/example.jpg"
    The cgi script has a problem reading that properly, even if I use the escape function. Yet when I try to send the information through the browser (?file=../home/example.jpg) , it works fine. I had the cgi script send back the information that flash was sending it to amke sure it got there okay, and it comes back correctly, it's just as if it is formatted differently or something. Perhaps it is my sub_parse. Here is my script:

    sub PARSE_FORM {
    if ($ENV{'REQUEST_METHOD'} eq 'GET'){
    @pairs = split(/&/, $ENV{'QUERY_STRING'});
    } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
    read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $buffer);
    } else {
    print "Content-type: text/html\n\n";
    print "Use POST or GET.";

    foreach $pair (@pairs) {
    ($key, $value) = split(/=/, $pair);
    $key =~tr/+/ /;
    $key =~ s/%(...)/ pack("c", hex($1))/eg;

    $value =~ s/<!--(.|\n)*-->//g;

    if ($formdata[$key]) {
    $formdata[$key] .= " , $value";
    } else {
    $formdata[$key] = $value;
    print "Content-type: text/html\n\n";
    if (-e $formdata[file]) {
    print "exists=true";
    } else {
    print "exists=false";

    Despite sending the same information through Flash and the web browser, I get false for Flash and true through the browser. PLEASE HELP! It is driving me insane!

  2. #2
    Registered User
    Join Date
    Feb 2001
    ($key, $value) = split(/=/, $pair);
    $key =~tr/+/ /;
    $key =~ s/%(..)/ pack("c", hex($1))/eg;
    ($key, $value) = split(/=/, $pair, 2);
    $value =~tr/+/ /;
    $value =~ s/%([0-9a-f]{2})/ pack("c", hex($1))/egi;


  3. #3
    that didn't do it. thanks for trying though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center