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

fORMFile

posted by mungiu 9 years ago

Great improvement for this. I try this new methods and it seems that i receive an error:

The fUpload method specified, setMaxFileSize(), is not a valid method

this is the way i put in my configuration class:


		fORM::mapClassToTable($this, 'stiri');
		fORMDate::configureDateCreatedColumn($this, 'data');
		fORMFile::configureFileUploadColumn($this, 'media', $_SERVER['DOCUMENT_ROOT'] . '/cd/uploads/stiri/');
		fORMFile::addFImageMethodCall($this, 'media', 'cropToRatio', array(
			1,
			1
		));
		fORMFile::addFUploadMethodCall($this, 'media', 'setMaxFileSize', array(
			'1mb'
		));
		fORMFile::addFImageMethodCall($this, 'media', 'resize', array(
			200,
			200
		));
		fORMValidation::setMessageOrder($this, array(
			'Uploads:',
			'Text:',
			'Titlu:'
		));
		fORMValidation::addStringReplacement($this, 'Media: Please enter a value', 'Uploads: Please enter a value');

That was an error in the documentation, it should be setMaxSize(). The method name was changed in r840, and I just fixed the fORMFile class documentation.

On a semi-related, there is a page BackwardsCompatibilityBreak that contains details of all such changes.

posted by wbond 9 years ago

Tanks, I have another question, can you tell me if i want to change the name of the file can I do this in this configuration?

posted by mungiu 9 years ago

No, you'd probably have to write a custom function and use fORM::registerHookCallback() to inject the functionality into the object. Let me know if you have trouble after reading through the documentation. If you do need help, be sure to include the code you've written so far.

posted by wbond 9 years ago