Uploading a pdf via powershell results in some jibberish


#1

Hey guys,
Its me again! I already posted yesterday about my troubles of getting powershell to work with the API, but I managed to solve most of my issues.
My end goal is to upload and replace pdf files using powershell. Everything works, but the files arent quite right, as powershell uploads some jibberish:


This is my script so far:

It also doesnt replace the pdf with the id 23, but thats probably due to the fact that the upload isnt recognized as a pdf. Im currently updating the access_token by hand, but I will paste my already working script for that in here too.
These are the contents of the uploaded File:
updateInLayouts=1&oldMediaId=23&files=System.Byte%5B%5D
Obviously very wrong, but where is my issue? I already did a lot of general googling, but nothing really helped
Thanks a lot for your help!