Software error: CGI open of tmpfile: Read-only file system i am getting this error on the page where i am uploading the excel file to the server. the code is below:

#!/usr/bin/perl use CGI; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use strict; use warnings; use diagnostics; use File::Basename; use CGI::SSI (autotie => 'STDOUT'); print CGI::header(); my $body; my $username="xxxxx"; my $password="xxxxx"; my $step =param('step'); my $user =param('user'); my $pass =param('pass'); my $excelfile =param('excelfile'); if ( (! defined $step) || (($step == 1) && ( ($user ne $username) || ( +$pass ne $password) ) ) ) { if (defined $step) { $body.= "<br><br>Incorrect Username or Password<br><br>" } $body.=<<htmlx; <form action="http://xxxxxxxxxxxxxxxx.org/cgi-bin/update.cgi" meth +od=post> ADMINISTRATOR LOGIN <br><br> Username : <input type=text name="user"> Password : <input type=password name="pass"> <input type=hidden name="step" value=1> <input type=submit value="Login"> </form> htmlx } else { if (($user eq $username) && ($pass eq $password)) { if ($step == 1) { $body.=<<htmlx; <form action="http://xxxxxxxxxxxxx.org/cgi-bin/update.cgi" met +hod=post> Upload excel file <input type=file name="excelfile" chars=40> <input type=hidden name="step" value=2> <input type=hidden name="user" value=$user> <input type=hidden name="pass" value=$pass> <input type=submit value="Submit"> </form> htmlx } # if ($step == 2) # { # my $query = new CGI; # my $upload_dir = "/home/www/xxxxxxxxxxxxxxxxxxx.org/excel"; # my $upload_filehandle = $query->upload("$excelfile"); # # open(EXCELFILE, ">$upload_dir/infosheet.xls"); # chmod("$upload_dir/infosheet.xls",0777); # while ( <$upload_filehandle> ) # { # print EXCELFILE; # } # close(EXCELFILE); # # } } } local $/ = undef; open(file, "/home/www/xxxxxxxxxxxxxxxxxxxxx.org/forcgi.shtml"); my $filedata= <file>; $filedata =~ s/\$body/$body/; close(file); print $filedata;


In reply to software error regarding as described below by ketaki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.