oczywiście pozmieniane w tablicy $accepted_origins na mój host. $imageFolder również wskazany na odpowiedni
Problem pojawia się w tym miejscu:
całość kodu php:
<?php // Only these origins are allowed to upload images $accepted_origins = array("http://localhost", "https://www.codexworld.com", "http://192.168.1.1", "http://example.com"); // Set the upload folder $imageFolder = "uploads/"; // same-origin requests won't set an origin. If the origin is set, it must be valid. } else { return; } } // Don't attempt to process the upload on an OPTIONS request if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { return; } /* If your script needs to receive cookies, set images_upload_credentials : true in the configuration and enable the following two headers. */ // header('Access-Control-Allow-Credentials: true'); // header('P3P: CP="There is no P3P policy."'); // Sanitize input return; } // Verify extension if (!in_array(strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION)), array("gif", "jpg", "jpeg", "png"))) { return; } // Accept upload if there was no origin, or if it is an accepted origin $filetowrite = $imageFolder . $temp['name']; // Determine the base URL // Respond to the successful upload with JSON. // Use a location key to specify the path to the saved image resource. // { location : '/your/uploaded/image/file'} }else{ return; } } else { // Notify editor that the upload failed } ?>
Źródło kodu: link