Image not get upload

Hello,

I had stuck in a prob that, some images alone not get uploaded in php (Using Yii1 framework). I thought it may be a memory problem so I had tried php.ini file (Changed mem size) but no luck.

Any help regards will be helpful.

Thanks Sally.

Post code. Have you added enctype in form tag?




<?php

use yii\widgets\ActiveForm;

?>


<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>


    <?= $form->field($model, 'imageFile')->fileInput() ?>


    <button>Submit</button>


<?php ActiveForm::end() ?>



taken from: http://www.yiiframework.com/doc-2.0/guide-input-file-upload.html#rendering-file-input

Images are getting upload yaar, but some images alone not get uploaded.

Check server error log

Will u tell me how to check error log?? (I had some doubts so)

check apache error.log (usally in /var/log/apache2/errors.log or similarly)

you can also check your log under runtime/logs/app.log

Not getting any errors. I had checked log too.

weird … without looking at code we can’t really help you much, try debugging it put var_dump to dump your $_FILES and $_POST inspect your input.

Also if you are doing processing (creating thumbnails, moving to s3) on file uploads, it might be your temp files are deleted by the OS before you get to process them.

First of all thanks for the response, I had checked the temp file name , there I got as {fail:7}. then I had print the uploaded file $_FILES[‘file’] there I got


Array

(

    [name] => asdfg.jpg

    [type] => 

    [tmp_name] => 

    [error] => 7

    [size] => 0

)

Any help :unsure:

I think its related to permissions

http://php.net/manual/en/features.file-upload.errors.php

I had already checked all these through Google but could not get any solutions, I have found the error (Hope will found the solution too). Anything else??

For information I had given a try to change upload & Memory sizes in php.ini file and restarted apache but no changes.

why don’t you try and set your upload_tmp_dir in php.ini to something other then /tmp perhaps /home/user/tmp

Thanks for all your responses, My prob got fixed.

What was the problem?

Memory size prob in the server fab, waste of time of mine.

Thanku.