Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
upload trouble cause of validation class
  • I'm uploading some files through a form which contains a required field 'Nom de dossier'... it works for 5 files but if i want to upload 6 files the a validation error 'Validation rule required failed for Nom de dossier' arrives... I don't understand what cause this error... can someone help me?
  • Validation only runs on input fields that are part of the posted form. Input fields of type "file" are not part of that form, so they can not be validated (that is why the Upload class contains validation for uploaded files). If you defined a validation rule for that field, it will fail because the input is not present.
  • I know that and I don't want to validate my upload file by the validation class.
    I want to validate the title who goes with the files,.
    there is only 1 title for all the files
    my files are uploaded with no problem (i checked) even with the validate error
    I think there is a link because everything (validation and upload) works from 1 to 5 files and it goes wrong after 5 files... there is no logic for me there, that's why I asked for help.
  • If we don't know what your code and your view looks like, all we can do is guess. Post them on http://scrp.at and we'll have a look...
  • I posted it: http://scrp.at/bit
    thanks
  • I don't see anything immediately wrong in there. The model (which I assume contains the validation rules) are missing from this, but I can't think of a reason why a rule would fail based on the number of uploaded files. Some low-level debugging is needed here, unless someone else has a bright idea...
  • here is my validation rule
    public static function validate($factory)
    {
    $val = Validation::forge($factory);
    $val->add_field('dossier', 'Nom de dossier', 'required');
    return $val;
    } this files correspond to the title I was talking about.
  • Nothing strange here too. Perhaps do a Debug::dump($_POST) before your $val->run(), to see what it exactly validates?
  • it send me: APPPATH/classes/controller/admin/photos.php @ line: 88
    Variable #1:
    array(0) {
    }
  • Nothing posted. Makes sense that the validation fails then. You'll have to check your form and application logic.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion