Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi Folks,
In case anyone is curious, one way to change the upload folder to something other than the root folder under DropBox is to modify the dropbox.php file on line 233 from
$uri = preg_replace("#(^|[^:])//+#", "\\1/","/files/{$root}/{$dbpath}?file={$filename}{$parstr}");
to
$uri = preg_replace("#(^|[^:])//+#", "\\1/","/files/{$root}/Insert/Desired/SubFolder/Path/Here/{$dbpath}?file={$filename}{$parstr}");
I am still not sure if there is a way to do this programatically through the UI but if anyone has thoughts on how I'd love to hear.
Cheers
Comments
Comment #1
-enzo- CreditAttribution: -enzo- commentedHello Muir
You appreciation is correct, to do this easy to maintain you can create a extra field in configuration page per user.
If you can do a patch for that I will really appreciate and include in next version.
Regards,
Comment #2
philsward CreditAttribution: philsward commentedWhen I tried the suggestion from the original issue, it ended up creating a folder inside the folder I wanted to upload to... During testing, I tried to upload to the pre-defined "Photos" folder, so I changed the above code, thinking it would stick it there. Instead, it created /Photos/Photos/myphoto.jpg
However, when I changed the line just above it:
and added /Photos after $root='dropbox', it uploaded just fine to the pre-defined Photos folder.
Also, if you have some problems after changing the location, make sure you clear your drupal cache.