Yes there was syntax errors in my previous post but i tried every
combination even with the correct syntax. The problem was the
$_FILES['uploadedfile']
which wasnt being recognised as a field
I found eventually that it should be
$_FILES['uploadedfile'] [Name]
now everything is fine
Thanks for the help
Ian
should be
if($_POST['Link']!=='' && $_FILES['uploadedfile']!=='') {
$error_msg.="<b r>You can't select to upload a link and a file at the same
time.";
}
error does shows when 'uploadedfile' is empty
if($_POST['Link']<>'' && $_FILES['uploadedfile']<>'') {
$error_msg.="<b r>You can't select to upload a link and a file at the same
time.";
}
error does shows when 'uploadedfile' is empty
if(!isset($_POS T['Link']) && !isset($_FILES['uploadedfile'])) {
$error_msg.="<b r>You can't select to upload a link and a file at the same
time.";
}
error does not show even when both fields have something in them
error does not show
"Martin Jay" <ma****@spam-free.org.uk> wrote in message
news:AP******** ******@spam-free.org.uk...
In message <vQ************ ******@newsfe3-win.ntli.net>, Ian Davies
<ia********@vir gin.net> writesCan anyone tell me why the following code will NOT work
The error message should be displayed when there is something in both
fields
if ((isset($_POST['Link']) && $_POST['Link'] !=='') &&
(isset($_POS T['uploadedfile']) && $_POST['uploadedfile'] !=='')) {
$error_msg.="<b r>You can't select to upload a link and a file at the
sametime.";
Here you're using $_POST['uploadedfile']. I'd guess it should probably
be $_FILES['uploadedfile']['name'], which is the name of the file that
was uploaded.
curiously the following works
if(empty($_POST['Link']) || $_POST['Link'] ='' &&
empty($_FILE S['uploadedfile']) || $_FILES['uploadedfile'] ='') {
$error_msg.="<b r>You didn't select whether to upload a link or a file.";
}
Here you're using $_FILES['uploadedfile'], which would be an array.
And $_POST['Link'] ='' will always be true because it is giving
$_POST['Link'] the value ''.
--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124