Joja a écrit :
* The second button is loaded/displayed _after_ you have clicked submit and
if there is a value in the db.
If there is a value in the db, just delete button should be enabled/showed,
without upload button.
And how db knows next upload file (not yet chosen) will be uploaded ?
So this is why i want to hide upload button after first upload.
That is your php which have to do that, but you would have not to do it
because on response the file field will be empty and nothing will have
to be send once more (except if you re-display last uploaded file path).
<?
$disbleSend = $disbleDelete = 'disabled';
if($send == 'Send')
{
$disbleDelete = '';
}
else if($send == 'Delete')
{
$disbleSend = '';
}
else
$disbleSend = $disbleDelete = '';
?>
<input type=submit name="send" value="Send" <?= $disbleSend ?/>
<input type=submit name="send" value="Delete" <?= $disbleDelete ?/>
Now,
tell me how I do when button [Send] is disabled to upload a new file ?
This time with a little bit of JS ?
<input type=file
onchange="this.form.elements['send'][0].disabled=false;
this.form.elements['send'][1].disabled=false;" />
(not tested)
You can also use JS to avoid user sends too times same file
(during time file is send user can believes action has failed)
<input type=submit onclick="this.disabled=true" blah />
Don't forget :
<form blah
onsubmit="if(del==1)
return confirm('Are you sure to want to delete this file?');">
<input type=submit name="send" value="Send"
onclick="del=0; this.disabled=true;" <?= $disbleSend ?/>
<input type=submit name="send" value="Delete"
onclick="del=1;" <?= $disbleDelete ?/>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé