-
Notifications
You must be signed in to change notification settings - Fork 517
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
File is not saved #203
Comments
Your problem is related to #200 Basically, changing this line: $photo1->setImage(new File(__DIR__ . "/../Files/image1.png")); by this one: $photo1->setImage(new UploadedFile(__DIR__ . "/../Files/image1.png", "image1.png")); should be enough. |
Thank you for your feedback. I have just changed the line and I got: Any advice? |
This method is really "upload" oriented (the bundle was developed to handle file uploaded with symfony forms). I thought this quick hack could work but after reading the UploadedFile source code it's clear that it won't. As it seems that the file is already present on your server, the bundle is currently unable to handle the work for you. It's indeed something that we should fix, but in the meantime you have no choice but to move the file and save its name in the entity yourself. |
So when I set the image name to photo1.png and save the file to the destination directory, would be it ok?:) Thanks. |
It should, yes :) |
Actually setting the parameter
This fixes the "not uploaded due to an unknown error" issue @petrjirasek described. |
Thank @chriwup this works for me |
Hi,
I would like to ask you if someone doesn't know where is the problem. I followed the configuration tutorial in doc and try to create a photo entity with the similar configuration.
Here is gist https://gist.github.com/Jirda/8901323
I have created a directory upload in the web directory but when I run the load code in a data fixture to create Photo entity, then the image is not saved and the upload directory is empty. Also, imageName is null.
Thank you for your notes.
The text was updated successfully, but these errors were encountered: