mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Check imported file type
This commit is contained in:
parent
8a3eb1f392
commit
e5c41d7b4a
@ -37,8 +37,18 @@ class ImportController extends BaseController
|
||||
$destinationPath = storage_path() . '/import';
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
|
||||
if ($source === IMPORT_CSV) {
|
||||
if ($extension != 'csv') {
|
||||
return redirect()->to('/settings/' . ACCOUNT_IMPORT_EXPORT)->withError(trans('texts.invalid_file'));
|
||||
}
|
||||
} elseif ($source === IMPORT_JSON) {
|
||||
if ($extension != 'json') {
|
||||
return redirect()->to('/settings/' . ACCOUNT_IMPORT_EXPORT)->withError(trans('texts.invalid_file'));
|
||||
}
|
||||
} else {
|
||||
if (! in_array($extension, ['csv', 'xls', 'xlsx', 'json'])) {
|
||||
continue;
|
||||
return redirect()->to('/settings/' . ACCOUNT_IMPORT_EXPORT)->withError(trans('texts.invalid_file'));
|
||||
}
|
||||
}
|
||||
|
||||
$newFileName = sprintf('%s_%s_%s.%s', Auth::user()->account_id, $timestamp, $fileName, $extension);
|
||||
|
@ -2488,6 +2488,7 @@ $LANG = array(
|
||||
'invoice_variables' => 'Invoice Variables',
|
||||
'navigation_variables' => 'Navigation Variables',
|
||||
'custom_variables' => 'Custom Variables',
|
||||
'invalid_file' => 'Invalid file type',
|
||||
|
||||
);
|
||||
|
||||
|
@ -40,10 +40,6 @@
|
||||
<div id="jsonIncludes" style="display:none">
|
||||
{!! Former::checkboxes('json_include_radio')
|
||||
->label(trans('texts.include'))
|
||||
//->check([
|
||||
// 'data' => true,
|
||||
// 'settings' => true
|
||||
//])
|
||||
->checkboxes([
|
||||
trans('texts.data') => 'data',
|
||||
trans('texts.settings') => 'settings',
|
||||
|
Loading…
x
Reference in New Issue
Block a user