forloop for upload script
This commit is contained in:
16
code/app.py
16
code/app.py
@@ -205,16 +205,22 @@ def script_upload(name = None, password = None):
|
|||||||
if not get_or_none(share,'upload') == True:
|
if not get_or_none(share,'upload') == True:
|
||||||
return "Upload not allowed",400
|
return "Upload not allowed",400
|
||||||
return """#!/bin/bash
|
return """#!/bin/bash
|
||||||
file_name="$1"
|
test -f "$1" || {
|
||||||
base_name=$( basename "$1" )
|
echo "Add files to upload as argument"
|
||||||
test -f "$file_name" || {
|
|
||||||
echo "Add file as argument"
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
CAT=$( which cat )
|
CAT=$( which cat )
|
||||||
which pv &> /dev/null && CAT=$( which pv )
|
which pv &> /dev/null && CAT=$( which pv )
|
||||||
|
|
||||||
$CAT "$file_name" | curl -F "file=@-;filename=${base_name}" %supload/%s/%s
|
for file_name in "$@"; do
|
||||||
|
base_name=$( basename "$file_name" )
|
||||||
|
test -f "$file_name" || {
|
||||||
|
echo "'$file_name' not a file"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$CAT "$file_name" | curl -F "file=@-;filename=${base_name}" %supload/%s/%s
|
||||||
|
done
|
||||||
"""%(
|
"""%(
|
||||||
request.url_root,
|
request.url_root,
|
||||||
name,
|
name,
|
||||||
|
|||||||
Reference in New Issue
Block a user