<?php
ini_set('display_errors', 1);
ini_set("log_errors", 1);
ini_set("error_log", "php-error.log");
error_reporting(E_ALL);

include "settings.php";
include "include/init.php";
include "include/functions.php";
  if ($token){
	foreach($_FILES as $file){
		$file_name = $file['name'];
		$file_tmp = $file['tmp_name'];
		$file_type = $file['type'];
		$file_size = $file['size'];
		@$file_ext = strtolower(end(explode('.', $file['name'])));

		//$file_name = "tmp/".$file_name;
		$file_name = $file_name;
		move_uploaded_file($file_tmp, $file_name);
		$media_id[] = json_decode(uploadpic($file_name),true);
		unlink($file_name);
	}
	echo json_encode($media_id);
  }
?>
