We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I upload an image to the media library using this?
The text was updated successfully, but these errors were encountered:
This seems to work. Note that you need to edit the user on WordPress and add an application password on their profile for this to work.
$client = resolve(WordPress::class); $client->setUrl('https://www.example.com'); $client->setUsername('***'); $client->setPassword('***'); $fileName = public_path('storage/81/307880052-1.jpg'); $file = new UploadedFile( $fileName, '307880052-1.jpg', 'image/jpeg', filesize($fileName), false ); $values = array( "date" => "2015-11-26 10:00:00", "date_gmt" => "2015-11-26 09:00:00", "modified" => "2015-11-26 10:00:00", "modified_gmt" => "2015-11-26 09:00:00", "status" => "future", "title" => "Titre media", "description" => "description media", "media_type" => "image", "source_url" => "https://example/storage/81/307880052-1.jpg" ); $response = $client->media()->create($file,$values);
Sorry, something went wrong.
No branches or pull requests
How do I upload an image to the media library using this?
The text was updated successfully, but these errors were encountered: