Closed inverse closed 10 years ago
Hi @inverse ! The current master
is currently not documented but support this: you simply have to implement your NamingStrategy and use it with the naming_strategy
configuration.
You can have a look on the test app in Tests
directory.
Note that the 2.0 version is using Gaufrette as storage helper so you can store in a local filesystem, or S3, or anything else :) I'll document this new version soon.
Thanks for getting back to me :)
Woah a lot has changed and I've not used Gaufrette before... looks interesting. I think I've got what I need need although when attempting to register my new NamingStrategy
and running composer install
I get a ServiceNotFoundException
. Any ideas?
Error
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "srio_rest_upload.storage.default" has a dependency on a non-existent service "\menschdanke\apibundle\strategy\contenttypefileextnamingstrategy".
Config
# RestUploadBundle configuration
srio_rest_upload:
storages:
default:
filesystem: gaufrette.default_filesystem
naming_strategy: MenschDanke\ApiBundle\Strategy\ContentTypeFileExtNamingStrategy
resumable_entity_class: SRIO\RestUploadBundle\Tests\Fixtures\Entity\ResumableUploadSession
The value of naming_strategy
have to be a service id.
That's way you can inject services you want to chose your file name if you
need !
On Monday, September 22, 2014, Malachi Soord notifications@github.com wrote:
Thanks for getting back to me. Woah a lot has changed and I've not used Gaufrette before. I think I've got what I need need although when attempting to register my new NamingStrategy I get a ServiceNotFoundException.
my config looks like
RestUploadBundle configurationsrio_rest_upload:
storages: default: filesystem: gaufrette.default_filesystem naming_strategy: MenschDanke\ApiBundle\Strategy\ContentTypeFileExtNamingStrategy resumable_entity_class: SRIO\RestUploadBundle\Tests\Fixtures\Entity\ResumableUploadSession``
— Reply to this email directly or view it on GitHub https://github.com/sroze/SRIORestUploadBundle/issues/10#issuecomment-56390499 .
Apologies for the constant bombardment of questions. I'm still getting the same error when I declare the naming strategy as a service by adding the following to my services.yml
mensch_danke_api.storage.strategy:
class: MenschDanke\ApiBundle\Strategy\ContentTypeFileExtNamingStrategy
and config.yml
now looks like
# RestUploadBundle configuration
srio_rest_upload:
storages:
default:
filesystem: gaufrette.default_filesystem
naming_strategy: @mensch_danke_api.storage.strategy
resumable_entity_class: SRIO\RestUploadBundle\Tests\Fixtures\Entity\ResumableUploadSession
C:\Code\MenschDanke\map>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "srio_rest_upload.storage.default" has a dependency on a non-existent service "@mensch_danke_api.storage.strategy
".
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an
exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command.
Sure, why do you prefix by "@" ? Just the name of the service :-)
On Monday, September 22, 2014, Malachi Soord notifications@github.com wrote:
Apologies for the constant bombardment of questions. I'm still getting the same error when I declare the naming strategy as a service by adding the following to my services.yml
mensch_danke_api.storage.strategy: class: MenschDanke\ApiBundle\Strategy\ContentTypeFileExtNamingStrategy
and config.yml now looks like
RestUploadBundle configurationsrio_rest_upload:
storages: default: filesystem: gaufrette.default_filesystem naming_strategy: @mensch_danke_api.storage.strategy resumable_entity_class: SRIO\RestUploadBundle\Tests\Fixtures\Entity\ResumableUploadSession
C:\Code\MenschDanke\map>composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files Updating the "app/config/parameters.yml" file
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] The service "srio_rest_upload.storage.default" has a dependency on a non-existent service "@mensch_danke_api.storage.strategy ".
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException] An error occurred when executing the ""cache:clear --no-warmup"" command.
— Reply to this email directly or view it on GitHub https://github.com/sroze/SRIORestUploadBundle/issues/10#issuecomment-56397355 .
I thought you had too.. Obviously not! All is working now! Thanks!
How would I go about appending the file extension to the uploaded files? I was thinking of having something like this in my
Media
model.However
$file->move()
doesn't work to theisValid()
failure onis_uploaded_file
I think.