Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 404 uplaod image #46

Closed
senprog opened this issue Jun 26, 2015 · 2 comments
Closed

Error 404 uplaod image #46

senprog opened this issue Jun 26, 2015 · 2 comments

Comments

@senprog
Copy link

senprog commented Jun 26, 2015

Hello,
I have a problem to upload the image to the server. I have installed the bundle, pop up displays correctly when I selected an image, it is uploaded to the server, but in return it does not appear in the pop up.
Looking at the console I noticed an error in routing. The URL I use to upload the files is as follows:

http: //localhost/congo-job/cj-symf/web/app_dev.php/demo/imageTest/new

but in the console I get this error:

Failed to load resource: the server responded with a status of 404 (Not Found)

http: //localhost/uploads/test/5bbfd314905a0b267d0b3f5c36ef0f8897415f42.jpg 1435321243541?

I already noticed that the path of the url are not correct.
Can anyone help me?

My entity :

Hello,
I have a problem to upload the image to the server. I have installed the bundle, pop up displays correctly when I selected an image, it is uploaded to the server, but in return it does not appear in the pop up.
Looking at the console I noticed an error in routing.
The URL I use to upload the files is as follows:

http: //localhost/congo-job/cj-symf/web/app_dev.php/demo/imageTest/new

but in the console I get this error:

Failed to load resource: the server responded with a status of 404 (Not Found)

http: //localhost/uploads/test/5bbfd314905a0b267d0b3f5c36ef0f8897415f42.jpg 1435321243541?

I already noticed that the path of the url are not correct.

Can anyone help me?

Hello,
I have a problem to upload the image to the server. I have installed the bundle, pop up displays correctly when I selected an image, it is uploaded to the server, but in return it does not appear in the pop up.
Looking at the console I noticed an error in routing.
The URL I use to upload the files is as follows:

http: //localhost/congo-job/cj-symf/web/app_dev.php/demo/imageTest/new

but in the console I get this error:

Failed to load resource: the server responded with a status of 404 (Not Found)

http: //localhost/uploads/test/5bbfd314905a0b267d0b3f5c36ef0f8897415f42.jpg 1435321243541?

I already noticed that the path of the url are not correct.

Can anyone help me?

id; } /** * Set photo * * @param string $photo * @return Image */ public function setPhoto($photo) { $this->photo = $photo; return $this; } /** * Get photo * * @return string */ public function getPhoto() { return $this->photo; } public function getUploadRootDir() { // absolute path to your directory where images must be saved return str_replace("\\", '\\\\', __DIR__.'/../../../../web/'.$this->getUploadDir()); } public function getUploadDir() { return 'uploads/test'; } public function getAbsolutePath() { return null === $this->photo ? null : $this->getUploadRootDir().'/'.$this->photo; } public function getWebPath() { return null === $this->photo ? null : '/'.$this->getUploadDir().'/'.$this->photo; } /** * Set originalImage * * @param string $originalImage * @return Image */ public function setOriginalImage($originalImage) { $this->originalImage = $originalImage; return $this; } /** * Get originalImage * * @return string */ public function getOriginalImage() { return $this->originalImage; } ``` } ImageType: getForm()->getData(); ``` $builder ->add('photo', 'comur_image', array( 'uploadConfig' => array( 'uploadRoute' => 'comur_api_upload', //optional 'uploadUrl' => $myEntity->getUploadRootDir(), // required - see explanation below (you can also put just a dir path) 'webDir' => $myEntity->getUploadDir(), // required - see explanation below (you can also put just a dir path) 'fileExt' => '*.jpg;*.gif;*.png;*.jpeg', //optional //'libraryDir' => null, //optional 'libraryRoute' => 'comur_api_image_library', //optional 'showLibrary' => true, //optional 'saveOriginal' => 'originalImage' //optional ), 'cropConfig' => array( 'minWidth' => 200, 'minHeight' => 200, 'aspectRatio' => true, //optional 'cropRoute' => 'comur_api_crop', //optional 'forceResize' => false, //optional 'thumbs' => array( //optional array( 'maxWidth' => 200, 'maxHeight' => 200, 'useAsFieldImage' => true //optional ) ) ) )) ; } /** * @param OptionsResolverInterface $resolver */ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\DemoBundle\Entity\Image' )); } /** * @return string */ public function getName() { return 'acme_demobundle_image'; } ``` } Image\new.html.twig : {% extends '::base.html.twig' %} {% block javascripts %} ``` <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script> <script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script> ``` {% endblock %} {% block body -%} ``` {% include "ComurImageBundle:Form:croppable_image_modal.html.twig"%}

Image creation

{{ form(form) }} {% endblock %}
@guizm0b
Copy link

guizm0b commented Nov 4, 2015

Hello,

Same problem here, the upload works fine but I can't manage to get the uploaded images after that (in the pop up).
The path looks like that : "http://localhost/uploads..." instead of something like that: "http://localhost/myfolder/web/uploads...".

Does anyone can help ?
Thank you.

@comur
Copy link
Owner

comur commented Jun 23, 2016

Hi, it's the same problem as issue #73

@comur comur closed this as completed Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants