A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: cgi script to write in txt file

  1. #1
    Member
    Join Date
    Mar 2001
    Posts
    77
    Hello,

    can anyone please help me find a cgi script that opens a txt file writes something in it (well a variable from flash) and then closes the file?? its so simple but couldn't find anything all morning..........

    thanks!

  2. #2
    __OSX powered__ nucleuz's Avatar
    Join Date
    Aug 2000
    Location
    Norway
    Posts
    836
    Here's a quick one that writes name and score to "score.txt":
    Code:
    #!/usr/bin/perl -w
    use strict;
    use CGI;
    my $cgi = new CGI;
    # The file you want to write to. (chmod 777 score.txt)
    my $file = "score.txt";
    # Print the correct header.
    print "Content-type: text/html\n\n";
    
    # Open the file in appen mode
    open(OUT, ">>".$file) or die "Error opening file : $!";
    
    # Append the score to the list:
    print OUT "Name:".$cgi->param('name').":Score:".$cgi->param('score')."\n";
    close OUT;
    print "wrote_score=yes";

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