Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
cURL to upload file error
Avatar
tdoan1971 #1
Member since Jun 2019 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: cURL to upload file error
I have a script to use cURL command in Windows to upload .png and .xlsx files to Dokuwiki server 5.3 instead of using the manual Media Manager

The flow is:
# Use cURL to login Wiki
curl -k --cookie cookie.txt --cookie-jar cookie.txt " \"https://wiki.jmn.mil/doku.php?id=start&do=login\" --data "sectok="real sectok --data"id=start" --data "do=login" --data "u=usrname" --data-urlencode "p=pwd"

# Use cookie file that has the login information to have cURL uploaded files
curl -k --cookie cookie.txt "https://wiki.jmn.mil/lib/exe/ajax.…?tab_files=files&… &image=imagefile &sectok=<real sectok> &mediaid=realmediaid &call=mediaupload&qqfile=real mediaid &ow=checked" --data-binary @sourceFile


I have multiple files to upload using the flow above with overwrite checked. Everything works well. Files are uploaded as expected. However there is a weird problem. Occasionally and very randomly, the curl upload command return the error message: {"error":"Sorry, username or password was wrong.You don't have permissions to upload files.","ns":"ee25:cl:cl04:tinok"}

Let say I have 20 files to upload, the 1st 4 files are uploaded successfully then the 5th file have the error above, the script continues the job and the rest of files are uploaded successfully.
The script then retried to upload the failed file several times but it gets the same error message. After a period of time which I don't know how long, the script does the job again and that file is uploaded successfully again but it may get the same error for different files.

I appreciate if anyone knows the issue and give me some hint to resolve.
Thank you,
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-10-17, 10:10:42 (UTC +02:00)