Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!

Online:Image Upload Issue

Avatar

Community Advisor

Hi,

I am getting below error while uploading images. Need quick assistance.

1723532_pastedImage_0.png

Thanks,

Anita

6 Replies

Avatar

Community Advisor

Hi,

Make sure both image and html are in the same location.

The image name has to be same inside the html as well.

Regards,

Venu

Avatar

Community Advisor

Hey Venu,

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

Regards,

Anita

Avatar

Community Advisor

Hi anitap82640902​,

I tested in my instance and it is working as expected.

There are multiple ways to upload an image.

Please check this thread and it will help you How to Upload a file using Webapp Adobe Campaign?

Regards,

Venu

Avatar

Community Advisor

Hi Venu,

Thank you for your response.

I will try this.

Regards,

Anita

Avatar

Community Advisor

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