I've added a addUpload control to a form for uploading images. But after save it, the DB result is like a temp file. How can I move the file to its final destination?
I've tried with:
$values = $form->getValues(); $values->image->move('/www/content/upload');
But it does not work.
Thanks a lot
Thanks, you 're right. The problem was the variable name.
But now, I could save the value in the database, but just the path '/www/content/upload’ is in the field. How can I set a valid filename?
Also, I have another problem. I've added the following rule to the form
->addRule(Form::IMAGE, ‘Thubnail must be JPEG, PNG or GIF’);
but when I run the page, an exception is raised:
Any idea what is this happening?
- Member | 1215
- I think, that addUpload() return something like name so you probably can call something like this:
But im not sure. If it is not work, use
and you'll see what actualy this value return.
- You are trying call Form without namespace. You have to use before class
or you have to write Form with namespace
of course the first solution is better ;-)
Thanks a lot. Both things works. But I have a last doubt. Finally, the move command was
I have one final doubt, if you allow me. The point is that “/www/content/upload” is the complete web path from the root, and in this way is stored in the DB. Could it be better to set there just relative paths and add the rest of the path with a global var? How can I define a global var to be fetched both from the Presenter and the latte template?