upload image
This commit is contained in:
@@ -68,6 +68,7 @@ class ApiController extends Controller {
|
||||
if ($post["id"] == 0) {
|
||||
$model = new CaptureLogs();
|
||||
$model->create([
|
||||
"Staff" => 0,
|
||||
"Time" => $time,
|
||||
"Image" => $fileName
|
||||
]);
|
||||
|
||||
@@ -170,7 +170,7 @@ class ConfigController extends Controller {
|
||||
]
|
||||
];
|
||||
$ip = "192.168.0.42";
|
||||
$tempConfig = json_decode(file_get_contents("http://192.168.1.241:4004/ReadAPIConfig", false, stream_context_create($options)), true);
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadAPIConfig", false, stream_context_create($options)), true);
|
||||
if ($tempConfig['status']) {
|
||||
$t = json_decode($tempConfig['data'], true);
|
||||
$temp = explode("/", $t['url']);
|
||||
|
||||
@@ -172,4 +172,15 @@ class ListManagementController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUpload() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$model = new common();
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"dataPath" => "BiFace/",
|
||||
"url" => $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "temp")
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user