Upload same image not working

In OS10.0.911.0 mobile,

I have an upload image and a delete image button.

I have a OnChange event on the upload image widget. 

I have a DeleteImageOnClick event on the delete image button.

I can upload an image.

In the DeleteImageOnClick, I set the binarydata variable to nullbinary. The image will disappear in the ui.

When i upload the same image again, it does not appear on the ui. 

Uploading a different image works fine.


Is this a known issue? 


This is because OnChange even only gets triggered when you change the value in target control. 

So in your case if you select same image again it doesn't actually change the value hence OnChange is not triggered.

Nikhil Gaur wrote:

This is because OnChange even only gets triggered when you change the value in target control. 

So in your case if you select same image again it doesn't actually change the value hence OnChange is not triggered.

so in that case, when i can DeleteImageOnClick, i need to clear the widget value via javascript , am i correct?



Instead of doing it using Javascript, you can set the variable (which is set in File Content property of file upload) to NullBinaryData().

Hi Joachim - did you manage to resolve this issue?
I have tried setting the File Content to NullBinary(), File Name to "", and even writing Javascript to clear the appropriate Filelist, but no luck.


The reupload works if I upload the same picture but change its filename...

Tarik Zulfikarpasic wrote:

Hi Joachim - did you manage to resolve this issue?
I have tried setting the File Content to NullBinary(), File Name to "", and even writing Javascript to clear the appropriate Filelist, but no luck.


The reupload works if I upload the same picture but change its filename...

What i did to solve the issue:


On my DeleteImageOnClick client action, I write a javascript:


var inputs = document.getElementById(UploadWidgetId).getElementsByTagName("input");

var i;

var length;

var value;

for(i = 0, length = inputs.length; i < length; i++)

{

if(inputs[i].type = "file")

{

inputs[i].value = "";

}

}


The solution is to set the value of inputs[i] to "" so that the next time you upload the same image, the upload widget recognises that the value is different, and your same image can be uploaded again.



Joachim Leow wrote:

Tarik Zulfikarpasic wrote:

Hi Joachim - did you manage to resolve this issue?
I have tried setting the File Content to NullBinary(), File Name to "", and even writing Javascript to clear the appropriate Filelist, but no luck.


The reupload works if I upload the same picture but change its filename...

What i did to solve the issue:


On my DeleteImageOnClick client action, I write a javascript:


var inputs = document.getElementById(UploadWidgetId).getElementsByTagName("input");

var i;

var length;

var value;

for(i = 0, length = inputs.length; i < length; i++)

{

if(inputs[i].type = "file")

{

inputs[i].value = "";

}

}


The solution is to set the value of inputs[i] to "" so that the next time you upload the same image, the upload widget recognises that the value is different, and your same image can be uploaded again.



Hi Joachim,

Did you tried setting variable to NullBinaryData()? Isn't it working in your app?


Nikhil Gaur wrote:

Joachim Leow wrote:

Tarik Zulfikarpasic wrote:

Hi Joachim - did you manage to resolve this issue?
I have tried setting the File Content to NullBinary(), File Name to "", and even writing Javascript to clear the appropriate Filelist, but no luck.


The reupload works if I upload the same picture but change its filename...

What i did to solve the issue:


On my DeleteImageOnClick client action, I write a javascript:


var inputs = document.getElementById(UploadWidgetId).getElementsByTagName("input");

var i;

var length;

var value;

for(i = 0, length = inputs.length; i < length; i++)

{

if(inputs[i].type = "file")

{

inputs[i].value = "";

}

}


The solution is to set the value of inputs[i] to "" so that the next time you upload the same image, the upload widget recognises that the value is different, and your same image can be uploaded again.



Hi Joachim,

Did you tried setting variable to NullBinaryData()? Isn't it working in your app?


Setting nullbinarydata() alone doesn't solve the issue. I need to use js too.