Advertisement
roynaldoindra

upload.php

Aug 12th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2. class Photo extends CI_Controller{
  3. function __construct(){
  4. parent::__construct();
  5.  
  6. header('Access-Control-Allow-Origin: *');
  7. header('Access-Control-Allow-Method: PUT, GET, POST, DELETE, OPTIONS*');
  8. header('Access-Control-Allow-Headers: Content-Type, x-xsrf-token');
  9. }
  10.  
  11. function upload() {
  12.  
  13. $target_path = "upload/";
  14.  
  15. $target_path = $target_path . basename( $_FILES['file']['name']);
  16.  
  17. if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
  18. echo "Upload and move success";
  19. } else {
  20. echo $target_path;
  21. echo "There was an error uploading the file, please try again!";
  22. }
  23. }
  24.  
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement