Accepted Solutions (0)

Answers (6)

Answers (6)

Anita_p

MVP

07-04-2019

Hi Venu,

I tried using the below code snippet to upload the image but it does not read the image path and gives the error:

var file = new File("<File Path on my local\image.jpg>"); 

if(!file.exists) 

     logError ("File '" + file.fullName + "' does not exist."); 

var extension = /[^.]+$/.exec(file.name); 

var md5 = HMACStr(file.name,"UTF-8","MD5"); 

 

----> Gives error, File does not exist.

if (!file.copyTo("path_to_adobe\\Adobe Campaign v6\\var\\res\\bootcamp\\" + md5 + "." + extension)) 

     logError ("File '" + file.fullName + "' was not copied"); 

var xmlString = '<fileRes alt="" codepage="0" height="0" name="owl.jpg" nature=""  publish="0" storageType="5" useMd5AsFilename="1" userContentType="0" version=""  width="0" xtkschema="xtk:fileRes"/>' 

var fileRes = xtk.fileRes.create( new XML(xmlString)); 

fileRes.contentType="image/jpeg"; 

fileRes.label = "some_label" 

fileRes.md5 = md5; 

fileRes.fileName = "path_to_adobe\\Adobe\\Adobe Campaign v6\\bin\\..\\var\\res\\bootcamp\\" + md5 + "." + extension; 

fileRes.originalName = "path_to_file\\Downloads\\mont.jpg"; 

fileRes.save();

Can you please assist on this?

Regards,

Anita

Anita_p

MVP

04-04-2019

Hey Venu,

Thank you for your response but I am just uploading image manually using: Resources->Online->Public Resources option.

Regards,

Anita