Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
legi
soft
gestex
Commits
030af16c
Commit
030af16c
authored
Oct 03, 2020
by
Gabriel Moreau
Browse files
Small bug, double .pdf...
parent
9ed64945
Changes
1
Hide whitespace changes
Inline
Side-by-side
module/db-functions.php
View file @
030af16c
...
...
@@ -103,8 +103,8 @@ function set_datasheet_new($pdo, $equipment_id, $datasheet_filename_upload, $tmp
if
(
!
is_dir
(
$new_datasheet_path
))
mkdir
(
$new_datasheet_path
,
0755
);
$datasheet_filename_kebab
=
string_to_filename_kebab
(
$datasheet_filename_upload
);
$datasheet_filename_no_ext
=
pathinfo
(
$datasheet_filename_upload
,
PATHINFO_FILENAME
);
$datasheet_filename_kebab
=
string_to_filename_kebab
(
$datasheet_filename_no_ext
)
.
'.pdf'
;
$sql1
=
'INSERT INTO datasheet (description, id_equipment) VALUES (?, ?);'
;
$stmt1
=
$pdo
->
prepare
(
$sql1
);
...
...
@@ -114,12 +114,12 @@ function set_datasheet_new($pdo, $equipment_id, $datasheet_filename_upload, $tmp
$sub_path
=
$id_datasheet
.
'-'
.
random_string
(
8
);
$sql2
=
'UPDATE datasheet SET pathname = ? WHERE id = ?;'
;
$stmt2
=
$pdo
->
prepare
(
$sql2
);
$stmt2
->
execute
(
array
(
$sub_path
.
'/'
.
$datasheet_filename_kebab
.
'.pdf'
,
$id_datasheet
));
$stmt2
->
execute
(
array
(
$sub_path
.
'/'
.
$datasheet_filename_kebab
,
$id_datasheet
));
$new_dir
=
$new_datasheet_path
.
'/'
.
$sub_path
;
if
(
!
is_dir
(
$new_dir
))
mkdir
(
$new_dir
,
0755
);
move_uploaded_file
(
$tmp_file
,
$new_dir
.
'/'
.
$datasheet_filename_kebab
.
'.pdf'
);
move_uploaded_file
(
$tmp_file
,
$new_dir
.
'/'
.
$datasheet_filename_kebab
);
return
$id_datasheet
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment