I am trying to use the Concrete Core Classes to create a user outside of the main folder structure.
For example I had a main folder called
Project One
-- concrete
-- application
-- packages
... etc etc
and another folder called user-upload. In here I have an import-users.php script.
I have a single page which has a form with a file upload element. This takes a CSV and tries to send it to the import-users.php script ready to loop through and create a new user for each row in the CSV. But I keep getting the following error when trying to use the classes:
Fatal error: Class 'Core' not found in path/user_upload/import-users.php on line 6 Call Stack: 0.2009 254592 1. {main}() path/user_upload/import-users.php:0
How can I use the class outside of the concrete5 installation?? Examples would be extremely helpful
Edit 1 Script to upload the CSV
$('#user_upload_submit').click(function () {
var fileInput = document.getElementById('usersfile');
var file = fileInput.files[0];
var formData = new FormData();
formData.append('file', file);
$.ajax({
type: "POST",
url: new_path+"user_upload/import-users.php",
data: formData,
contentType: false,
processData: false,
success: function (msg) {
$('#user_result').html(msg);
},
error: function (jqXHR, exception) {
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
alert(msg);
}
});
});