public function SmartImporterFileUploadController::uploadFile in Commerce Smart Importer 8
Handles uploaded files.
1 string reference to 'SmartImporterFileUploadController::uploadFile'
File
- src/
Controller/ SmartImporterFileUploadController.php, line 65
Class
- SmartImporterFileUploadController
- File upload handler.
Namespace
Drupal\commerce_smart_importer\ControllerCode
public function uploadFile(Request $request) {
$image = $request->files
->get('file');
if (!is_dir(CommerceSmartImporterConstants::TEMP_DIR)) {
mkdir(CommerceSmartImporterConstants::TEMP_DIR);
}
$image
->move($this->fileSystem
->realpath(CommerceSmartImporterConstants::TEMP_DIR) . '/', $image
->getClientOriginalName());
return new Response('Uploaded successfully');
}