Hi @abrar,
I don’t see where in your code you’re creating a upload token?
You can use this tutorial as a starting point:
https://developer.kaltura.com/workflows/Ingest_and_Upload_Media;step=intro
It’s not exactly what you need but by following it you’ll gain an understanding of how uploading works in general.