Announcement

  •  » Miscellaneous
  •  » err"=:405,"message":"The image (file) is missing",using pwg.images.add

#1 2019-03-04 18:42:21

atkinja
Member
2019-03-03
2

err"=:405,"message":"The image (file) is missing",using pwg.images.add

Hello/Hi/Greetings,

Related to https://piwigo.org/forum/viewtopic.php?id=27025 but created a new one because it was noted as resolved.

Ironically I am still getting the same problem, even when using the recommendations on SIZE and the new CurlFile.


<?php⏎
include('Requests/library/Requests.php');⏎
Requests::register_autoloader();⏎
$user = "my-user";⏎
$password = "my-password";⏎
$url = "my-url";⏎
$session = new Requests_Session($url);⏎
$body = array(⏎
␉·······'method' => 'pwg.session.login',⏎
␉·······'username' => $user,⏎
␉·······'password' => $password⏎
);⏎
$response = $session->post($url,array() ,$body );⏎
$params = array(⏎
␉·······'method' => 'pwg.session.getStatus'⏎
);⏎
$s = $session->post($url,array() ,$params );⏎
$manage = json_decode($s->body, true);⏎
$token =  $manage['result']['pwg_token'];⏎
$filepath = "test.jpg";⏎
$filename = "sloth";⏎
$settings = array(⏎
␉·······'method' => 'pwg.images.addSimple',⏎
␉·······'category'=>'1',⏎
␉·······'pwg_token'=> $token,⏎
␉·······'image'=> new CurlFile($filepath),⏎
␉·······'name' => $filename⏎
␉·······);⏎
print_r($settings);⏎
$t = $session->post($url,array( 'Content_Type' => 'form-data') , $settings );⏎
print ($t->body);⏎



That code still shows: {"stat":"fail","err":405,"message":"The image (file) is missing"

PHP 7.1.23
Latest version of piwigo as I just downloaded it

This seems so basic to do, yet I am failing to get it o upload the image. 

Any thoughts?  And preferably I don't want the image to be a local file, but rather a URL I reference on the web.

Offline

 
  •  » Miscellaneous
  •  » err"=:405,"message":"The image (file) is missing",using pwg.images.add

Board footer

Powered by FluxBB

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