0

I have a foreach loop which cycles through a bunch of images, and uploads them using this code:

    foreach(var image in fetchimages) {

    string fileName = "https://www.mywebsite.co.uk" + image.ImageOriginalURL;
    var uploadParams = new ImageUploadParams()
    {

        File = new FileDescription(fileName)
    };
    var uploadResult = cloudinary.Upload(uploadParams); 

    var mytest = new ImageUploadResult();
    myurl = mytest.SecureUri;

    db.Execute("UPDATE Property_Images SET NewURL = @0 WHERE ImageID = 145", myurl);
} 

However, each time, the myurl variable is empty. I'm thinking i possibly have the ImageUploadResult() in the wrong place in the foreach loop?

Gavin5511
  • 791
  • 5
  • 31

1 Answers1

2

You are creating an empty upload result and checking the value there. Please try uploadResult.SecureUri Also, it's best to check uploadResult.Error to see if an error occurred in the upload.

Tal Lev-Ami
  • 1,417
  • 10
  • 10