Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Change SWFUpload upload directory


Reply


4 Posts   2462 Views

Avatar
theoldlr

Community Member, 103 Posts

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!

Avatar
UncleCheese

Forum Moderator, 4094 Posts

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');

Avatar
theoldlr

Community Member, 103 Posts

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')
)
);

}

Avatar
UncleCheese

Forum Moderator, 4094 Posts

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.