0

I am a beginner in php. In order to upload some files, I put the script.php below on a server (hosted by another company) and for more than a year it has been okay for my need.

<?php

    $file_path = "";

    $file_path = $file_path . basename( $_FILES['uploaded_file']['name']);
    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path)) {
        echo "success";
    } else{
        echo "fail";
    }
 ?>

All of the sudden this stopped working with the error message below.

PHP Notice:  Undefined index: uploaded_file in /home/someFolders/script.php on line 5
PHP Notice:  Undefined index: uploaded_file in /home/someFolders/script.php on line 6

What could have gone wrong and what should I change to make my uploads work again?

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
user3793589
  • 418
  • 3
  • 14
  • 3
    Show the `html` portion. – Sazzadur Rahaman Jul 20 '18 at 00:01
  • That sounds awful. Could please you replace the file with the following and paste the output here after submitting a file ` –  Jul 20 '18 at 00:02
  • @SazzadurRahaman, there is no html portion – user3793589 Jul 20 '18 at 00:14
  • @Terminus, the whole file ? – user3793589 Jul 20 '18 at 00:15
  • 1
    Fair enough. Where is the form, from where a user will upload a file? – Sazzadur Rahaman Jul 20 '18 at 00:18
  • Really just want to see the output of the `var_dump`. Replacing it would just be temporary; doesn't *need* to be the whole file but reducing the number of things going on is key to troubleshooting. –  Jul 20 '18 at 00:21
  • 2
    @SazzadurRahaman, finally found the issue. Was related to the fact that the file upload limit in the php.ini has been suddenly decreased by my hosting service. The fact that really small files were still being uploaded gave me this hint. Thank you for your help – user3793589 Aug 13 '18 at 13:53
  • @Terminus, finally found the issue. Was related to the fact that the file upload limit in the php.ini has been suddenly decreased by my hosting service. The fact that really small files were still being uploaded gave me this hint. Thank you for your help – user3793589 Aug 13 '18 at 13:57

0 Answers0