Error loading image?

When recording the image drops error.
finfo_file(C:\Windows\Temp\phpCB42.tmp): failed to open stream: No such file or directory
For some reason the temporary file no.
Actually the code itself:
public function uploadImage()
{
 if ($this->validate()) {
 $this->img->saveAs('redactor/upload/image/' . $this->img->baseName . '.' . $this->img->extension);
 return true;
 } else {
 return false;
}
 }
July 9th 19 at 10:30
5 answers
July 9th 19 at 10:32
Solution
If someone else encounter such a problem. Found a strange solution, first recorded in the database model, and then performed the file upload to the server. Why that worked I do not know.
July 9th 19 at 10:34
May be it was not created because of lack of access rights to the folder?
The access is. - Eladio_Bra commented on July 9th 19 at 10:37
but in the $_FILES array that is? - Dannie_Gutmann77 commented on July 9th 19 at 10:40
:
array(1) { ["Post"]=> array(5) { ["name"]=> array(1) { ["img"]=> string(9) "Basya.png" } ["type"]=> array(1) { ["img"]=> string(9) "image/png" } ["tmp_name"]=> array(1) { ["img"]=> string(27) "C:\Windows\Temp\php31BB.tmp" } ["error"]=> array(1) { ["img"]=> int(0) } ["size"]=> array(1) { ["img"]=> int(1116336) } } } - Eladio_Bra commented on July 9th 19 at 10:43
July 9th 19 at 10:36
Pow

TMP extension is a temporary file that can also take extension .TEMP. Although temporary files have the same extensions TMP, they can be generated by various programs. Because of this, it is difficult to understand which program, creates a temporary TMP file, or even where the file .TMP.

Sometimes, the part of the file name before the extension gives the user a clue as to what program created the file. For example, if the file name 2006_annual_report.tmp, the file may be a Word document or Excel spreadsheet that was named "2006_annual_report ". Also, the location of temporary files may help the user to identify the program that created the file. For example, if the user discovers the temporary file in the folder "Temp" or "Tmp", which is located in the main folder of a certain application, the temporary file is likely to belong to this application.
July 9th 19 at 10:38
If you decide to mess with php on windows, use at least open-server.ru
for temporary files will create a special folder (instead of the system vintovoi), which would be guaranteed access.
Today put openserver the same result
finfo_file(C:\OpenServer\userdata\temp\php6032.tmp): failed to open stream: No such file or directory - Eladio_Bra commented on July 9th 19 at 10:41
And yesterday raised the dev Ubuntu and also the same result - Dannie_Gutmann77 commented on July 9th 19 at 10:44
July 9th 19 at 10:40
And You do not mind that in the FILE you php31BB.tmp, and the error phpCB42.tmp?
And You do not mind the fact that it was made in a different time, respectively, and the name of the temporary file more. - Eladio_Bra commented on July 9th 19 at 10:43
: Ie temporary file is created where expected, but still No such file or directory? - Dannie_Gutmann77 commented on July 9th 19 at 10:46
: File I also do not see it, but maybe by the time the file already removes the system - Eladio_Bra commented on July 9th 19 at 10:49
: saveAs deletes the file after move, it is necessary to understand at what stage I get an error. I think that the file is moved to the desired position, and then to him again there is an appeal. What You have in $this->img? Show the complete code, including the model and action, which takes $_FILES - Eladio_Bra commented on July 9th 19 at 10:52
: Found the solution, first recorded model, and after completed the file download. Just do not quite understand why it is so. - Eladio_Bra commented on July 9th 19 at 10:55
If You gave Your code - probably would get the answer. There surely is a virtual attribute $file. And the logic in beforeSave, so the name of the file to save is not correct. But without code this is guesswork. - Eladio_Bra commented on July 9th 19 at 10:58

Find more questions by tags ImagesYiiPHP