sarvan75 / yii-user

Automatically exported from code.google.com/p/yii-user
0 stars 0 forks source link

file field don't work, when i have other fields in profile #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.add file field for upload image to profile
2.add one or more other fields to profile (first name, last name, etc..)
3.submit the form

What is the expected output? What do you see instead?
The expected output is, that the file is uploaded, but it doesnt work
All of the submitted data was saved, but the file wasnt uploaded.

What version of the product are you using? On what operating system?
1.1.6, Debian Linux, Apache/2.2.16, PHP 5.3.2-2 with Suhosin-Patch

Please provide any additional information below.
When I add only the file field to the profile, the upload works.

Original issue reported on code.google.com by hea...@gmail.com on 1 Mar 2011 at 1:06

GoogleCodeExporter commented 9 years ago
Sorry guys for submitting this. It isn't an issue. 
I found the solution: I must disable the activeform's validation for the file 
field.

'disableAjaxValidationAttributes'=>array('RegistrationForm_verifyCode', 
'Profile_photo'),

By the way, it will be helpful to write this to the documentation, not?
And.. sorry for my bad english.

Original comment by hea...@gmail.com on 1 Mar 2011 at 1:39

GoogleCodeExporter commented 9 years ago
Arrgh, my solution on 1st comment works only, when I delete(comment) 2 lines on 
the components/UWFile.php:

//if ($model->validate()) { 
  if ($old_file&&file_exists($old_file))
  unlink($old_file);
  $value->saveAs($file_name);
//}

The $model->validate() returns false, when i have more fields in profile.
..but it isn't a good solution.

Original comment by hea...@gmail.com on 1 Mar 2011 at 1:51