7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Change SWFUpload upload directory
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1914 Views |
-
Change SWFUpload upload directory

22 May 2010 at 5:12am
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!
-
Re: Change SWFUpload upload directory

22 May 2010 at 8:38am
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');
-
Re: Change SWFUpload upload directory

25 May 2010 at 2:28am
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')
)
);}
-
Re: Change SWFUpload upload directory

25 May 2010 at 9:39am
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.
| 1914 Views | ||
|
Page:
1
|
Go to Top |

