Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Upload directories for fORMFile::configureImageUploadColumn

posted by aris 9 years ago

Hello.

I'm using a form to upload an array of image files, so using fORMFile::configureImageUploadColumn looks as a good solution to deal with all the required checking. However, I would need to put those files in diverse user directories, so I can't put a fixed path in the configure method().

As I'm not sure about the order in which ORM processing is done, would it be right adding a $upload_path property to my model class to use it within the configure method? i.e.:


public $upload_path;
protected function configure()
{
    fORMFile::configureImageUploadColumn($this, 'picture', $this->upload_path);
}

That way I could set that property on each case.

Regards,

A.

The configure method is only called once at the beginning of the script execution, so that won't solve your problems.

Even if it did, fORMFile expects to manage the file upload directory, so if you move then out it is going to start getting really confused when files can't be found.

I'm not sure what type of file checking you are looking to do, but fUpload combined with fValidation does everything except for handing files that have already been uploaded on a previous form post. This is the part that requires fORMFile to manage the upload directory and keep track of the files. It sounds like in your situation you'll need to roll your own that can handle multiple directories.

If you have any questions about how to handle this and can provide the beginning of the code, I can help you flesh out some of it.

posted by wbond 9 years ago