Welcome Guest, Not a member yet? Register   Sign In
retain multi file upload if validation is not successful
#4

[eluser]d1a8lo24[/eluser]
Ok well there is no support in the validation class for this type of validation.

You can probably do a call back to execute your own validation but that is where you need to get creative since the post var FILE is an array that contains not only the information of the file being uploaded but also the error and success messages of the upload operation and other pieces of info.

Not an easy answer.

So there is no easy way to do this specially if you have other fields being submitted in the same form like a regular text field.

The reason is that when you validate a regular field you can use the validation class and if there is an error it will just return the errors and with some code you repopulate the fields with the submitted values.

Now in order to get any kind of errors in file upload the file needs to go through the process uploading so if you have two files and one fails you can't repopulate the successful field since the file has already been uploaded and if you do then you will re upload the file again and this can either overwrite the file or create a new one and you will end up having duplicates of the files.

So depending on your form I would have a separate upload form this way you can have more control over the uploads.

So I hope I made my self a little clear and in the long run maybe you'll find a way to do it by writing a very large code block but at the end you will see that making things simple an efficient are the way to go.

So here is a link to the php file upload section so you can understand a little more the mechanics behind it.

http://www.php.net/manual/en/features.fi...method.php


Messages In This Thread
retain multi file upload if validation is not successful - by El Forum - 05-16-2011, 02:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB