Announcement

  •  » Extensions
  •  » C# or vb implementation of pwg.images.upload

#1 2017-01-17 08:17:27

Bronze
Member
2017-01-17
2

C# or vb implementation of pwg.images.upload

Hello,

I'm trying to incorporate Piwigo file sync on my vb program I got the pwg.session.login, pwg.session.status and pwg.images.checkUpload working, but I can't get the pwg.images.upload to work (err 501, missing method name. I just wonder if anybody have this implementation on vb or c#.
Here is the code:

working:
'\\\\\\\\\\\\\\\\\\\\\\ Login PIWIGO /////////////////////
Public Function PWGAuthentication() As String

PWGUrl = "http://www.praecones.org/photos/ws.php?format=json"
PWGMethod = "method=pwg.session.login"
PWGusername = "user"
PWGpassword = "password"

Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP")
xmlhttp.open "POST", PWGUrl, False
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send PWGMethod & "&username=" & PWGusername & "&password=" & PWGpassword

PWGAuthentication = xmlhttp.responseText

End Function

Not Working:

'\\\\\\\\\\\\\\\\\\\\\\ PIWIGO File Upload /////////////////////
Public Function PWGUploadFile() As String

PWGUrl = "http://www.praecones.org/photos/ws.php?format=rest"
PWGMethod = "method=pwg.images.upload"
PWGFile = "c:\pwg\P10100011.jpg"

xmlhttp.open "POST", PWGUrl, False
xmlhttp.setRequestHeader "Content-Type", "multipart/form-data"
xmlhttp.send "method=pwg.images.upload&image=c:\pwg\P10100011.jpg&pwg_token=" & PWGToken

PWGUploadFile = xmlhttp.responseText

End Function


Piwigo version: 2.7.4
PHP version: 5.6.29
MySQL version: 5.6.32-78.1
Piwigo URL: http://www.praecones.org/photos/ws.php

Offline

 

#2 2017-01-18 16:47:33

kenl
Member
2013-01-12
91

Re: C# or vb implementation of pwg.images.upload

Here's a C# example, but is uses .AddSimple not .upload.  Nevertheless, perhaps it will be useful to you.  See function SyncPiwigoAddPhoto().


http://piwigo.org/svn/extensions/Picasa … tusForm.cs

Offline

 

#3 2017-01-18 18:55:33

Bronze
Member
2017-01-17
2

Re: C# or vb implementation of pwg.images.upload

Hi kenl

Yes! this will help a lot. I will try that asap 
Thank you very much.

Offline

 
  •  » Extensions
  •  » C# or vb implementation of pwg.images.upload

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact