AM I correct in assuming you have:
2 radiobuttons - one to display 5 file upload fields and one to display 10 upload fields.
A quick and dirty solution would be to hide/show through javascript and css:
<input name="showups" type="radio" value="0" onclick="show_up(5);return false;" selected="selected" /><label for="show5">Show 5 upload fields</label>
<input name="showups" id="show10" type="radio" value="1" onclick="show_up(10);return false;" /><label for="show10">Show 10 upload fields</label>
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<div id = "extras" class="show">
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
<input type="file" name="upload[]" />
</div>
This gives an array of file elements (0 - 9).
In your head area:
<script>
function show_up(x){
if(x > 5){
document.getElementById('extras').className = 'show';
}else{
document.getElementById('extras').className = 'hide';
}
}
</script>
<style>
.hide{
display:none;
}
</style>
If you fill file widgets in range 5-9 and then hide the last 5, they will still try to upload the files - so you could write something a bit "cleverer" to deal with this. This is just an example - I wouldn't use this in a production site.
Reputation Points: 1054
Solved Threads: 949
Sarcastic Poster
Offline 6,700 posts
since Oct 2006