The cgi script folder is normally not writeable to by the web server for security. Try adding
to your script to see what is causing the internal erroruse CGI::Carp 'fatalsToBrowser'; # use only while debugging
or try this SSCCE which writes to /tmp
poj#!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use CGI::Carp 'fatalsToBrowser'; # use only while debugging use Cwd; my $cwd = getcwd(); # current working directory my $event = param('event') || 1; my $newCOMMENT = param('newCOMMENT') || 'test comment'; my $commentUID = time(); my $path = '/tmp'; my $fileA = "$path/$event.txt"; my $fileB = "$path/$commentUID.txt"; if ($newCOMMENT ne "") { open AFH, '>>', $fileA or die "Could not open $fileA : $!"; print AFH "$commentUID\n"; close AFH; open BFH, '>>', $fileB or die "Could not open $fileB : $!"; print BFH "$newCOMMENT\n"; close BFH ; } print header,start_html; print pre(" cwd : $cwd event : [$event] newCOMMENT : [$newCOMMENT] commentUID : $commentUID"); print end_html;
In reply to Re: open file using variable passed by form
by poj
in thread open file using variable passed by form
by michael.kitchen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |