I want to upload a new PDF to replace the content in an existing asset. I would like to find a way to do this preferably using the JS API, or some other way so that I can programmatically update hundreds of files in a batch operation.
Just wondering if anyone could point me in the right direction. Will setContentOfEditableFileAsset do this?
Upload/Replace File Of An Existing Asset
AshKyd
(Squiz)
#1
Anthony_Barnes
(Anthony Barnes)
#2
That function will only work for file assets that have an edit contents screen (text file and javascript file). To actually upload a file you will need to either use the SOAP API and the file retrieval service (which basically means you need a base 64 encoded string of the file content), or using the JS API you would need to be able to post a file upload to it's _edit url (We have code to deal with this in Easy Edit - /Libs/EasyEditFileUpload.js). The JS method isn't ideal, but it gets the job done.