$kategori   = $_POST['kategori'];
                        $nama       = $_POST['nama'];
                        $harga      = $_POST['harga'];
                        $deskripsi  = $_POST['deskripsi'];
                        $status     = $_POST['status'];

                        $filename = $_FILES['gambar']['name'];
                        $tmp_name = $_FILES['gambar']['tmp_name'];

                        $type1 = explode('.', $filename);
                        $type2 = $type1[1];

                        $newname = 'produk'.time().'.'.$type2;

                        $tipe_diizinkan = array('jpg', 'jpeg', 'png', 'gif');

                        if(!in_array($type2, $tipe_diizinkan)){
                            echo '<script>alert("Success")</script>';
                            move_uploaded_file($tmp_name, './produk/'.$newname);


Error :
Warning: move_uploaded_file(./produk/Foto Hafiz BINUS.jpg): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/bukawarung/tambah-produk.php on line 90

Warning: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpru3RaQ' to './produk/Foto Hafiz BINUS.jpg' in /Applications/XAMPP/xamppfiles/htdocs/bukawarung/tambah-produk.php on line 90

Want to ask if the move_uploaded_file () section is correct for uploading files but after uploading files but doesn't appear in the forder on Mac?
And if you try it on a Windows OS laptop it can and does work and while on a Macbook OS it's an error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.