I’m looking for some suggestions to check if this is possible.
I’m writing a wcf service which allows the client to upload files.
I want to add a validation layer into my web service without the client having to upload the file.
So the client makes a request to wcf service with the file, but before it uploads I want to validate the file name and then possibly make a request to the client to send the file.
I could have 2 interfaces on my webservice: validatefile() and uploadfile() and the result from the validationfile() but ideally i would like to do it via a single interface.
Any suggestions?
EDIT: the validation is done to check the file size and filename. because the file might be 600mb, ideally i need to perform the check before the file is uploaded but within the service.
You don’t need separate interfaces unless you want to. It would be perfectly acceptable to have both the Validate and Upload methods in the same interface.
Beyond that, if you want to force a consumer to first call validate, then you could return a Guid “key” from the Validate method, and then have the consumer pass this key into the upload method. No upload key, no upload. Even with this approach, you will want to re-validate in the upload.
So your validate method could look something like this: