-
Notifications
You must be signed in to change notification settings - Fork 4
/
reciveCv.php
46 lines (41 loc) · 1.27 KB
/
reciveCv.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* Save file to
*/
$token_valid = "ninja";
$applicantId = Params::getParam('applicantId');
if(!isset($applicantId) || $applicantId=='') {
// error applicantId is a required field
exit;
}
$secret = Params::getParam('secret');
if(!isset($secret) || $secret=='') {
// error applicantId is a required field
exit;
}
if(Params::getParam('token') == $token_valid) {
$applicantCv = ModelJB::newInstance()->getCVFromApplicant($applicantId);
if($applicantCv['s_secret'] != $secret) {
// error secret don't match
exit;
}
$file = Params::getFiles('uploaded_file');
if(isset($file['name']) && $file['name']!='') {
if( $file['error'] == UPLOAD_ERR_OK ) {
$fileName = $file['name'];
$tmp_name = $file['tmp_name'];
$path = osc_get_preference('upload_path', 'jobboard_plugin');
if( move_uploaded_file($tmp_name, $path.$fileName) ) {
// update applicant cv
ModelJB::newInstance()->updateFile($applicantId, $fileName, $secret);
} else {
// error_log('error al move_uploaded_file');
}
} else {
// error_log('error al hacer upload');
}
} else {
// error_log('no file uploaded');
}
}
?>