Setting Upload Location
Permalink
Hello C5 Ninjas ::
We're developing a site which we expect to have regular upload activity.
We'd like to be able to have the uploads go a directory such as
/uploads so that client can setup a FTP client to watch for uploads.
What do you all think is the best way to do this?
We're developing a site which we expect to have regular upload activity.
We'd like to be able to have the uploads go a directory such as
/uploads so that client can setup a FTP client to watch for uploads.
What do you all think is the best way to do this?
Can anyone provide some feedback on this? We do appreciate your loving help.
The file uploads that are built into the c5 form block uses the file library. So if that's not going to work for you, you can either change the way the form block is saving files, or create a single page with a custom form on it that does what you want.
If you want to override the functionality of the form block, you'd copy:
[siteroot]/concrete/blocks/form/controller.php
to:
[siteroot]/blocks/form/controller.php
then modify where the file importer is called (around line:270). You'd write some standard file upload code & specify whatever directory you want.
The other probably cleaner option would be to create a single page & controller (search for "single pages" on this site) that handles your custom form post & stores your files & data wherever you'd like.
hope that gets you started..
If you want to override the functionality of the form block, you'd copy:
[siteroot]/concrete/blocks/form/controller.php
to:
[siteroot]/blocks/form/controller.php
then modify where the file importer is called (around line:270). You'd write some standard file upload code & specify whatever directory you want.
<?php $fi = new FileImporter(); $resp = $fi->import($_FILES[$questionName]['tmp_name'], $_FILES[$questionName]['name']); if (!($resp instanceof FileVersion)) { switch($resp) { case FileImporter::E_FILE_INVALID_EXTENSION: $errors['fileupload'] = t('Invalid file extension.'); break; case FileImporter::E_FILE_INVALID: $errors['fileupload'] = t('Invalid file.'); break; } ?>
The other probably cleaner option would be to create a single page & controller (search for "single pages" on this site) that handles your custom form post & stores your files & data wherever you'd like.
hope that gets you started..
Hi Ryan ::
Thanks for the detailed response. We'll take a look at those options.
Very helpful! Hope this helps someone else, too.
Marc
Thanks for the detailed response. We'll take a look at those options.
Very helpful! Hope this helps someone else, too.
Marc