in reply to Confusing Syntax
Besides the syntax errors that others have already corrected, I'd like to make some suggestions.
You use 15 differently named input fields. Perhaps you don't know that when you create 15 that all have the same name, you can get a list from $q->param.
Photo 1: <input type=file name=photo><br> Photo 2: <input type=file name=photo><br> Photo 3: <input type=file name=photo><br> ...
#!/usr/bin/perl -w use strict; use CGI; my $cgi = CGI->new; my @pictures = $cgi->param('photo'); ...
You don't check the value of $album and then you use it. This means that anyone can create directories anywhere the web server can. Very dangerous.
The script doesn't check if open succeeded. When it can't create the file, it silently continues.
It is a very good idea to indent your code. Inside {} blocks, indent everything to visualize the block. This makes reading code much easier. Especially when you ask for help, you should do everything you can to make it easy to read.
I forgot the most important mistake. The code doesn't use strict. Always use strict!
Your code will not work with strict without modification. A good Perl book or tutorial will tell you how to change your code. If you don't already have a good Perl book, try Beginning Perl. It's free.use strict;
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Confusing Syntax
by eoin (Monk) on Aug 12, 2003 at 11:57 UTC | |
by Juerd (Abbot) on Aug 12, 2003 at 12:09 UTC | |
by eoin (Monk) on Aug 12, 2003 at 18:50 UTC |