-
-
Save mipapo/cafe45b0c2a247d9c0614bd2cc8fe4d0 to your computer and use it in GitHub Desktop.
Runalyze Upload fast API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#call/upload.php | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Methods: GET, POST'); | |
header("Access-Control-Allow-Headers: X-Requested-With"); | |
require_once '../inc/class.Frontend.php'; | |
$Frontend = new Frontend(true); | |
System::setMaximalLimits(); | |
if(count($_FILES) == 1) { | |
$filename = 'api'.uniqid().$_FILES['fileUpload']['name']; | |
move_uploaded_file($_FILES['fileUpload']['tmp_name'], '../data/import/'.$filename); | |
$Factory = new ImporterFactory($filename); | |
foreach ($Factory->trainingObjects() as $training) { | |
$training->insert(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment