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
Mihkel Putrinš
panustaja
Commits
c8718293
Commit
c8718293
authored
Nov 23, 2015
by
Mihkel Putrinš
Browse files
fix
parent
f4e28ed6
Changes
1
Hide whitespace changes
Inline
Side-by-side
code/upload.js
View file @
c8718293
...
...
@@ -57,6 +57,7 @@ function addEntuFile(eid, file_path, callback) {
}
}
// var req = request.post(options, function (err, resp, body) {
var
req
=
request
.
post
(
options
,
function
(
err
)
{
// console.log(err, resp, JSON.parse(body))
if
(
err
)
{
...
...
@@ -68,11 +69,13 @@ function addEntuFile(eid, file_path, callback) {
}
})
var
form
=
req
.
form
()
var
read_stream
=
fs
.
createReadStream
(
file_path
)
req
.
form
.
append
(
'
file
'
,
read_stream
)
req
.
form
.
append
(
'
entity
'
,
eid
)
req
.
form
.
append
(
'
property
'
,
'
resource-file
'
)
req
.
form
.
append
(
'
filename
'
,
path
.
basename
(
file_path
))
form
.
append
(
'
file
'
,
read_stream
)
form
.
append
(
'
entity
'
,
eid
)
form
.
append
(
'
property
'
,
'
resource-file
'
)
form
.
append
(
'
filename
'
,
path
.
basename
(
file_path
))
read_stream
.
on
(
'
data
'
,
function
(
chunk
)
{
uploaded_files_progress
+=
chunk
.
length
console
.
log
(
'
Uploaded:
'
+
uploaded_files_progress
+
'
(+
'
+
chunk
.
length
+
'
)
'
)
...
...
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