Alternative for html form Action

Hello,

I’m creating an webapp where I have to upload a file to the server. The riscy part is it has to work on Internet Explorer 11.
I tried to make it work but keep failing. I already created a backend php on the server where the file has to be uploaded and I created an html file to test the php at there it works perfect.

Upload html file:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">

  <title>Upload file test</title>
</head>

<body>
	<form action="phpBackEnd/upload.php" method="post" enctype="multipart/form-data">
	    Select image to upload:
		<input type="file" name="fileToUpload" id="fileToUpload">
		<input type="submit" value="Upload Image" name="submit">
	</form>
</body>
</html>

Upload php backend file:

<?php
   header('Access-Control-Allow-Origin: *');

    date_default_timezone_set('Europe/Brussels');
	$fileNamePrefix = date("ymdHis")."_";
	$currentYear = date("Y");
	$currentMonth = date("m");
    $target_dir = "./../../../redmine/htdocs/files/".$currentYear."/".$currentMonth."/";
	$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
	$uploadOk = 1;
	$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
	// Check if image file is a actual image or fake image
	if(isset($_POST["submit"])) {
		$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
		if($check !== false) {
			echo "File is an image - " . $check["mime"] . ".<br>";
			$uploadOk = 1;
		} else {
			echo "File is not an image.";
			$uploadOk = 0;
		}
	}
	
	// Check if file already exists
	if (file_exists($target_file)) {
		echo "Sorry, file already exists.";
		$uploadOk = 0;
	}
	
	 // Check file size
	if ($_FILES["fileToUpload"]["size"] > 50000000) {
		echo "Sorry, your file is too large.";
		$uploadOk = 0;
	}
	
	// Allow certain file formats
	if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
	&& $imageFileType != "gif" ) {
		echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
		$uploadOk = 0;
	}
	
	// Check if $uploadOk is set to 0 by an error
	if ($uploadOk == 0) {
		echo "Sorry, your file was not uploaded.";
	// if everything is ok, try to upload file
	} else {
		if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
			echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
		} else {
			echo "Sorry, there was an error uploading your file.";
		}
	}
	
?>

The php is limited to images for testing purposes. But when used it will need to handle images, pdf files and word files.

Is there anyway to convert this html file to make it work with the php backend file inside an ionic webapp? Or is there another way to easy upload files with the browser and with Internet Explorer 11 with a rewritten php backend file or other backend type of file.

Thanks for your knowledge. I’m already breaking my head over this for over a week.

Greetings,
Nyffellare