Need to check file field for content in <cfinput type="file" name="custCartThumb">

T

trint

With the following code, I get the "message" whether or not there is
content in my filefield:

function check_file_field()
{
var file_field = document.getElementById("custCartFile");
if(file_field.value.length == 0)
{
alert("You are required to select an Image");
return false;
}
else
{
return true;
}
}

<cfinput type="file" name="custCartThumb">
<cfinput type="submit" name="submit" value="Add Image" onClick="return
check_file_field()">

It's like the function does not detect if the cfinput type="file"
contains anything!
Any help is appreciated.
Thanks,
Trint
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top