T
T
The Dragger2015-04-06 13:08:13
Yii
The Dragger, 2015-04-06 13:08:13

Why can't he see the path to the image?

I am using a form widget.
here is the code that does it

if(isset($_POST['submit'])){
            if($_FILES['img_url']['error'] == 0){
                move_uploaded_file($_FILES['img_url']['tmp_name'],
                Yii::app()->request->baseUrl . 'images/upload/' . $_FILES['img_url']['name']);
            }
}

The image gets where it should be, but the validation gives the following error:
You must fill in the "Path to the image" field.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Grechushnikov, 2015-04-06
@IPD2

probably because you do not fill in the MODEL field where the picture should be. on this piece of code, you only copy the image from temporary storage

A
Andrey Mokhov, 2015-04-06
@mokhovcom

offtopic: the MySQL tag is definitely in the subject of the question...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question