Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vMap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open source
vMap
Commits
a16b018e
Commit
a16b018e
authored
Jan 9, 2019
by
Armand Bahi
Browse files
Options
Downloads
Patches
Plain Diff
Gestion de fichiers multiples en POST
parent
46915fee
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/module_vmap/web_service/ws/Querys.class.inc
+7
-46
7 additions, 46 deletions
src/module_vmap/web_service/ws/Querys.class.inc
with
7 additions
and
46 deletions
src/module_vmap/web_service/ws/Querys.class.inc
+
7
−
46
View file @
a16b018e
...
@@ -17,6 +17,7 @@ require_once 'Query.class.inc';
...
@@ -17,6 +17,7 @@ require_once 'Query.class.inc';
require_once
'BusinessObject.class.inc'
;
require_once
'BusinessObject.class.inc'
;
require_once
(
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/BdDataAccess.inc'
);
require_once
(
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/BdDataAccess.inc'
);
require_once
(
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/phpUtil.inc'
);
require_once
(
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/phpUtil.inc'
);
require_once
(
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/files/Files_manager.class.inc'
);
require_once
'vmlib/logUtil.inc'
;
require_once
'vmlib/logUtil.inc'
;
require_once
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/Vm.class.inc'
;
require_once
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/class/vmlib/Vm.class.inc'
;
...
@@ -52,8 +53,7 @@ class Querys extends Vmap {
...
@@ -52,8 +53,7 @@ class Querys extends Vmap {
$this
->
aValues
[
'getGroup'
]
=
false
;
$this
->
aValues
[
'getGroup'
]
=
false
;
$this
->
oConnection
=
new
Connection
(
$this
->
aValues
,
$this
->
aProperties
);
$this
->
oConnection
=
new
Connection
(
$this
->
aValues
,
$this
->
aProperties
);
// error_log('$_FILES: '. print_r($_FILES, true));
error_log
(
'$_FILES: '
.
print_r
(
$_FILES
,
true
));
// error_log('$aValues: '. print_r($this->aValues, true));
}
}
/**
/**
...
@@ -1637,50 +1637,11 @@ class Querys extends Vmap {
...
@@ -1637,50 +1637,11 @@ class Querys extends Vmap {
// Fichiers à uploader ?
// Fichiers à uploader ?
if
(
!
empty
(
$_FILES
)
&&
!
empty
(
$this
->
aValues
[
'my_vitis_id'
]))
{
if
(
!
empty
(
$_FILES
)
&&
!
empty
(
$this
->
aValues
[
'my_vitis_id'
]))
{
// Création du dossier contenneur
$sDirPath
=
$this
->
createElementFilesFolder
(
$sBusinessObjectId
,
$this
->
aValues
[
'my_vitis_id'
]);
if
(
!
is_dir
(
$sDirPath
))
{
$oError
=
new
VitisError
(
1
,
"Unable to acces to the business object direrctory :"
.
$sDirPath
);
$aXmlRacineAttribute
[
'status'
]
=
0
;
$sMessage
=
$oError
->
asDocument
(
''
,
'vitis'
,
$this
->
aValues
[
'sEncoding'
],
True
,
$aXmlRacineAttribute
,
$this
->
aValues
[
'sSourceEncoding'
],
$this
->
aValues
[
'output'
]);
return
$sMessage
;
}
// Écriture du fichier
// Écriture du fichier
$oFileManager
=
new
Files_manager
(
$this
->
aProperties
);
foreach
(
$_FILES
as
$sName
=>
$aFile
)
{
foreach
(
$_FILES
as
$sName
=>
$aFile
)
{
$aUploadReturn
=
$oFileManager
->
uploadInWsDataDir
(
'vitis'
,
$sBusinessObjectId
,
$this
->
aValues
[
'my_vitis_id'
],
$sName
,
'documents'
);
$sDirColumnPath
=
$sDirPath
.
'/'
.
$sName
;
$this
->
aValues
[
$sName
]
=
$aUploadReturn
[
'field_value'
];
if
(
!
is_dir
(
$sDirColumnPath
))
{
mkdir
(
$sDirColumnPath
,
0777
,
true
);
}
// Fichiers multiples
if
(
is_array
(
$aFile
[
'name'
])){
$this
->
aValues
[
$sName
]
=
""
;
for
(
$i
=
0
;
$i
<
count
(
$aFile
[
'name'
]);
$i
++
)
{
// Remplace la valeur en base par le nom du fichier
if
(
empty
(
$this
->
aValues
[
$sName
]))
{
$this
->
aValues
[
$sName
]
=
$aFile
[
'name'
][
$i
];
}
else
{
$this
->
aValues
[
$sName
]
.
=
'|'
.
$aFile
[
'name'
][
$i
];
}
// Écrit le fichier dans son enplacement
uploadFile
(
$sName
,
""
,
$sDirColumnPath
.
"/"
.
$aFile
[
'name'
][
$i
],
$aFile
[
'size'
][
$i
],
$aFile
[
'tmp_name'
][
$i
]);
}
}
// Fichier simple
else
{
// Remplace la valeur en base par le nom du fichier
$this
->
aValues
[
$sName
]
=
$aFile
[
'name'
];
// Écrit le fichier dans son enplacement
uploadFile
(
$sName
,
""
,
$sDirColumnPath
.
"/"
.
$aFile
[
'name'
],
$aFile
[
'size'
]);
}
}
}
$this
->
genericPut
(
$bo_schema
,
$bo_table
,
$bo_id_field
);
$this
->
genericPut
(
$bo_schema
,
$bo_table
,
$bo_id_field
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment