Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File

Status
Not open for further replies.

conceptmgt

IS-IT--Management
Sep 12, 2001
45
GB
Hi

I use the code below to request all the file input boxes from my form. But if I have 5 file input boxes and only 3 of them have a new file selected it will only add 3 items to my array. I want it to add all 5 even if they are blank. How could I do this?

i=0
For Each File In Uploader.Files.Items
ReDim Preserve arrImages(i)
arrImages(i) = File.FileName
i = i + 1
Next

Thanks

Gary
 
you can't have a blank element in the array I believe. the option I can think of to get around it is to add a value in palce of the blank value. like "blank" _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
 
Hi

Thanks but the problem is that For Each File In Uploader.Files.Items only reads file boxes with values it ignores the ones without values. You cannot even give it a default value.

<input name=&quot;image1&quot; type=&quot;file&quot; size=&quot;10&quot;>

Thanks Again

Gary
 
give it the value needed onSubmit client side _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
 
javascript

in the head sectiopn of the page
function giveValue() {
for (counter=0; counter<myForm.length; counter++){
if(document.myForm.elements[coutner].value == &quot;&quot;) {
document.myForm.elements[counter].value == &quot;blank&quot;
}
}
}

in the form tag
<form name=&quot;myForm&quot; onSubmit=&quot;giveValue()&quot;>

give that a shot
_________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
 
here's a bit of a better example
<html>
<head>
<script>
function giveValue() {
var frm = document.myForm;

for (counter=0; counter<myForm.length; counter++){
if(frm.elements[counter].type == &quot;text&quot; && frm.elements[counter].value == &quot;&quot;) {
frm.elements[counter].value = &quot;blank&quot;;
alert(frm.elements[counter].value + &quot; &quot; + frm.elements[counter].name);
}
}
}
</script>
</head>

<body>
<form name=&quot;myForm&quot; onSubmit=&quot;giveValue()&quot;>
<input type=&quot;text&quot; name=&quot;txt1&quot; value=&quot;&quot;><br>
<input type=&quot;text&quot; name=&quot;txt2&quot;><br>
<input type=&quot;text&quot; name=&quot;txt3&quot;><br>
<input type=&quot;text&quot; name=&quot;txt4&quot;><br>
<input type=&quot;text&quot; name=&quot;txt5&quot;><br>
<input type=&quot;text&quot; name=&quot;txt6&quot;><br>
<input type=&quot;text&quot; name=&quot;txt7&quot;><br>
<input type=&quot;submit&quot; value=&quot;submit&quot;>
</body>
</html> _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top