Answer the question
In order to leave comments, you need to log in
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'].'");
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question