I'm trying to upload an image using angular and vichUploaderBundle for symfony.
The idea is the following,
I have some tabs, if you click on them they'll display different forms, one of them is for file uploading. My question is, How can I upload the image? I mean the correct way. I have a html.twig file, with a form inside (I'm using includes of twig engine). Suppose I have this form.html.twig
<form onsubmit="{{ path('upload-new-file') }}">
<input type="file" id="someFile"/>
<button> Upload Image </button>
</form>
Once you've selected the image, click on Upload, this will determine which URL matches with upload-new-file(routing.yml) (for example, It'll do some query to upload the file)
My main problem is that I get confused because I've been programming my forms in php (using createForm, form->isvalid, etc) and then rendering them with twig, I'm also using vichUploaderBundle. In the situation that I've described I'm not able to do that, because I don't have the "form" to render it. ({{form(form)}}). I'm not passing the form as parameter in the usual way (like in the symfony docs; $this->render('someTemplate.html.twig',array ('form' => $form)))
Imagine that we have a web page, with tabs, and if you click in one of the tabs, It'll display some form, one of the forms contains an upload input, you select an image and click on upload, what then? Recall that I'm using angularjs, vichuploaderbundle, symfony and Doctrine as ORM.
Thanks in advance!