Can you change the location of where files are uploaded to? In the documentation it says:
Parameter name Default Value Purpose
file_destination_path none DEPRECATED
Thanks!
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
Can you change the location of where files are uploaded to? In the documentation it says:
Parameter name Default Value Purpose
file_destination_path none DEPRECATED
Thanks!
Depends on the context. If you're using a FileDataObjectManager, which is the context of most SWFUpload usage, you can just do:
$my_dom->setUploadDir("some/path");
But if you're using SWFUpload elsewhere, fallback on the config:
SWFUploadConfig::set_var('default_upload_dir', 'some/path');
I tried using the Config as you suggested, and maybe there is an updated way to do what I want now, but I was following the documentation. The file still ends up in the assets/Uploads folder.
Here is my code:
public function UploadForm()
{
SWFUploadConfig::set_var('default_upload_dir', 'assets/Upload/ForFab');
return new Form(
$this,
"UploadForm",
new FieldSet(
new TextField('Name'),
new EmailField('Email'),
new SWFUploadField(
"UploadForm",
"Drawings",
"Upload your drawing files...",
array(
'required' => 'true',
'browse_button_text' => 'Choose your file(s)'
)
)
),
new FieldSet(
new FormAction('doUploadSubmit', 'Send File')
)
);
}
It belongs in _config.php, not your UploadForm function. It only counts when the handleswfupload() function runs. UploadForm() is not in play when the file is written.