Hi fellow monks,
Im currently working on a project for a bio-computing problem but im having a problem with uploading a file from the users home dir via web page. I have a cgi script to run as the home page with a file upload box. the code in this html file contains:
print("<form action=Project1.cgi method=POST ENCTYPE=\"multipart\form-
+data\">");
which then when executed calls up Project1.cgi.
Im new to this game so i need some help....
I cant seem to open the file the user chooses. the code for Project 1 is given below. Any help given is taken with an enlightened thanks.
########
# not sure about this
my @file =();
my $html = new CGI;
my $filehandle = $html->upload('upload');
my $filename = $html->param('upload');
my $line;
my @cols;
########
# read through the file and get the sequence
sub checkFile()
{
# print("The path name was: $file");
print("Opening File...");
open( FILE, "<$filehandle") or die("Error opening the file<BR>");
print("File is now open");
@file = <FILE>;
print("<BR><BR> @file<BR><BR>");
while($line = <FILE>)
{
chomp($line);
if($line =~ /([^ACGTacgt])/) {next;}
else
{
@cols = split(/\s/, $line);
print("@cols");
}
close( FILE ) or die("Error closing the file<BR>");
print("File is now closed");
}
}
Cheers fellow monk buddies.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.