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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null values FileFields and validation

Status
Not open for further replies.

markdt

Technical User
Feb 15, 2006
63
GB
Hi All,

I have a problem validating FileFields.

Basically the code i have is:

msds=Uploader.Files("file1").FileName
prod=Uploader.Files("file2").FileName

I want what is in file1 and file2 in variables msds and prod.

Say i enter a valid file path for "file2" and leave file1 blank. When the form is posted it errors with "Object required: '[undefined]' "

I believe this is a Null value problem as it only happens when a file path is not entered into either file1 or file2.

I have tried many if statements to check to see if these have values but nothing seems to work. Any ideas would be greatly appreciated.

Thanks

Mark
 
Have you tried....

msds="" & Uploader.Files("file1").FileName

Or

If Not IsNull(Uploader.Files("file1").FileName) Then
msds=Uploader.Files("file1").FileName
End If



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Im afraid ive tried both of the suggestions and it still says:

Object required: '[undefined]'

Any more ideas?

Thanks
 
did you register uploader object correctly.

the error does not look like is related to the NULL values...

-DNG
 
Maybe....

If Not Uploader Is Nothing Then
msds=Uploader.Files("file1").FileName
End If


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Im getting the same error again.

I have also tried:

If Not Uploader.Files("file2") Is Nothing Then
prod=Uploader.Files("file2").FileName
End If

The error refers to the first line of code. Even if i try to refer to file2 it says object required [undefined]. Seems like it doesnt exist at all if no file is specified.

Anymore ideas would be appreciated.

Thanks

Mark
 
Hi All,

Ive sorted it used the code below works great.

Thanks for all your help.

If IsEmpty(Uploader.Files("file1")) Then
else
msds=Uploader.Files("file1").FileName
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top