0

I have a Codeigniter 3 project. There was no problem when I was running the site locally, but when I uploaded it to the ngxi server, I got this error: "The upload destination folder does not appear to be writable." My codes are as follows:

public function yazar_update($id) {
    $data = array('isim' => $this->input->post('title'));

    // Yükleme yapılandırması
    $config['upload_path'] = './assets/images/'; // Fotoğrafı kaydedeceğimiz dizin
    $config['allowed_types'] = 'jpeg|jpg|png'; // İzin verilen dosya türleri
    $config['max_size'] = 2048; // Maksimum dosya boyutu (KB)
    $config['encrypt_name'] = TRUE; // Dosya adını rasgele oluştur

    $this->upload->initialize($config);

    // Dosya yükleme işlemi
    if (!$this->upload->do_upload('image')) {
        $update = $this->db->where("yazar_id", $id)->update("yazarlar", $data);
        if ($update) { redirect(base_url("Af45sdieD/edit_yazar/$id")); }else{ print("Olmadı"); }
    } else {
        // Yükleme başarılı
        $upload_data = $this->upload->data();
        $data['yazar_image'] = $upload_data['file_name'];

        $update = $this->db->where("yazar_id", $id)->update("yazarlar", $data);
        if ($update) { redirect(base_url("Af45sdieD/edit_yazar/$id")); }else{ print("Olmadı"); }
    }
}

View code:

<form action="<?= base_url("yazar_update/$yazar->yazar_id"); ?>" method="POST" class="create-form" enctype="multipart/form-data">
                        <h2 class="heading text-center">Yazar Bilgilerini Değiştir</h2>
                        <div class="form-group mb-4">
                            <label for="title">Başlık</label>
                            <input type="text" class="form-control" id="title" name="title" value="<?= $yazar->isim; ?>" required>
                        </div>
                        <div class="form-group mb-4">
                            <label for="title">Kapak Resmi</label>
                            <input type="file" class="form-control" id="image" name="image">
                        </div>
                        <div class="form-group mb-4">
                            <label>Mevcut Kapak Resmi</label>
                            <hr>
                            <img style="width: 200px;" src="<?= base_url("assets/images/$yazar->yazar_image"); ?>" alt="Kapak Resmi" class="img-fluid">
                        </div>
                        <button id="submitBtn2" type="submit" class="btn btn-primary" style="display: block; width: 100%;">Yazar Bilgilerini Güncelle</button>
                    </form>

Note: The permissions of the assets folder are 777 (I'm sure of this). I'm using ngxi server. Please help me or I'll go crazy. Thanks in advance.

3
  • the folder path is correct and there is no SELinux etc. on the server. Commented Aug 15, 2024 at 5:38
  • I don't have a user called www-data, I have clp and root. Commented Aug 15, 2024 at 5:41
  • 2
    "The permissions of the assets folder" - you are not uploading to the assets folder. Commented Aug 15, 2024 at 7:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.