I can see you’re using a variable named $prodfilename but then in the else statement you are using $prodimgurl.
$prodimgurl = '';
I can see you’re using a variable named $prodfilename but then in the else statement you are using $prodimgurl.
$prodimgurl = '';