symfony - Symfony2 - How do you set the upload path outside of the bundle? -


I'm new to the completely new thing, I'm trying to fix my file upload Uploading it, the file within the bundle will have to be uploaded to the public_html folder outside the bundle

Why do I need to change my functionality below so that the uploadpath is out of the Symphony Project folder?

Server folder setup:

  / etc / / symfony project folder / public_ftp / / public_html / & lt; --- This is where I want to getUploadDir () to get it public function {return 'images /'; } Public function getUploadRootDir () {return __DIR__ '/../../../../web/' $ this- & gt; getUploadDir (); } Public function getWebPath () {return tap === $ this- & gt; Image? Zero: $ this- & gt; GetUploadDir () '/' $ this- & gt; Image; } Public function getAbsolutePath () {return tap === $ this- & gt; Image? Free: $ this- & gt; GetUploadRootDir () '/' $ this- & gt; Image; }    

Change your getUploadRootDir to:

  Public function getUploadRootDir () {return __DIR__. '/../../../../../public_html/' $ this- & gt; getUploadDir (); }   

This will put your images in public_html / images / , even if you want them directly in public_html < Code> getUploadDir from:

  public function getUploadDir () {return '';;; }    

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -