Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Photo extends CI_Controller{
- function __construct(){
- parent::__construct();
- header('Access-Control-Allow-Origin: *');
- header('Access-Control-Allow-Method: PUT, GET, POST, DELETE, OPTIONS*');
- header('Access-Control-Allow-Headers: Content-Type, x-xsrf-token');
- }
- function upload() {
- $target_path = "upload/";
- $target_path = $target_path . basename( $_FILES['file']['name']);
- if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
- echo "Upload and move success";
- } else {
- echo $target_path;
- echo "There was an error uploading the file, please try again!";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement