V
V
viktorross2020-05-24 16:10:26
PHP
viktorross, 2020-05-24 16:10:26

Why is the image not saved to the php folder?

hello, please tell me what I'm doing wrong, I need to upload the image to a folder and save the name to the database, but nothing happens

if($_POST['image']) {

    if(isset($_FILES['image']['name']) && $_FILES['image']['name']) {

      global $config_abs_path;
      $dir = $config_abs_path."/images/baners";
      $this->img = new image('image', $dir, "banner");
      $this->img->setGenerate(1);
      $this->img->verify();
      if($this->img->upload()){
  // если эта строка тут, даже записи в бд не будет, если ее оставить до загрузки файла, то запись имени файла будет в базе, но сам файл по прежнему не загрузится $this->clean['image'] = escape($_POST['image']);
        //$this->clean['image']=$this->img->getUploadedFile();
      }

    }

}

  $db->query('insert into `class_banners` set `filename` = "'.$this->clean['image'].'");


or please tell me a simple way in my case of downloading a file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2020-05-24
@AUser0

Either look for PHP errors in the web server log file (error.log), or temporarily turn on the display of execution errors on the screen - this is already in the script itself.
PS There is a good chance that PHP does not have permission to create files in the specified directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question