I have Error to file SampleUpLoadFile.php to return KalturaClientBase.php:579

I try Upload file data and return to file https://github.com/kaltura/php-api-examples/blob/master/SampleUpLoadFile.php

Fatal error: Uncaught exception ‘KalturaException’ with message ‘Upload failed’ in C:\xampp\htdocs\php-api-examples-master\KalturaClientBase.php:579 Stack trace: #0 C:\xampp\htdocs\php-api-examples-master\KalturaClient.php(1943): KalturaClientBase->throwExceptionIfError(Array) #1 C:\xampp\htdocs\php-api-examples-master\SampleUpLoadFile.php(35): KalturaMediaService->upload(‘piano.m4v’) #2 {main} thrown in C:\xampp\htdocs\php-api-examples-master\KalturaClientBase.php on line 579

Please help !!! i have Attachments Photo and source code php :slight_smile:

Hi @pongploydev_2016,

The code under https://github.com/kaltura/php-api-examples/blob/master/SampleUpLoadFile.php is very old and media->upload() has since been deprecated. It’s not the reason why it does not work since we never remove deprecated APIs but I don’t recommend you use it. There isn’t enough info to determine why it failed but regardless, you should be using the uploadToken service to perform the upload.
There is a PHP CLI script here https://github.com/kaltura/platform-install-packages/blob/Lynx-12.12.0/RPM/scripts/postinst/upload_test.php which demonstrates how to use it. If you’re running Kaltura CE, the script is also placed under /opt/kaltura/bin/upload_test.php since it is called from /opt/kaltura/bin/kaltura-sanity.sh.

There is also a step by step interactive workflow for it here:
and a fully functional jquery based code example here: https://github.com/kaltura/chunked-file-upload-jquery