angular-base64-upload icon indicating copy to clipboard operation
angular-base64-upload copied to clipboard

After selected a file input field shows "None selected"

Open juri33 opened this issue 7 years ago • 11 comments

How can i change the text in the input field? After selected a file the text is "None selected". Is this wanted behavior?

If i set breakpoint in my on-change function on angular.element("#input_imageUpload").innerHTML = this.uploadedImage.filename; i can see the filename in the input field but then it will be overwritten???

Is it also possible to change the input button text?

juri33 avatar May 08 '17 12:05 juri33

This is the current behaviour, unfortunately. I'm not sure if this "wanted" though.

This happens because after selecting a file, we change the input value to empty in order that selecting the same file will trigger a change event. See the issue here #77

I did not realize it will change the text of the button to "None selected".

Yes, I think it is possible to override the button text. But this is currently not supported. Would you like contributing your solution and write a pull request?

adonespitogo avatar May 08 '17 13:05 adonespitogo

Thank you for your fast answer. Unfortunately we changed our requirement not to encode images :-|

juri33 avatar May 09 '17 14:05 juri33

@juri33 adonespitogo/angular-base64-upload@c23ab67?diff=unified#diff-10e55e709b2fd51c2729a0fc806ec6bfR190 it's working

venzeles avatar May 11 '17 17:05 venzeles

@adonespitogo, is it an intended behaviour to clear the filename (which normally appears when a file is selected)?

htalat avatar Jun 30 '17 13:06 htalat

No. This is a bug @htalat

adonespitogo avatar Jun 30 '17 13:06 adonespitogo

@adonespitogo took a quick look at the code scope._clearInput is being called at the end of elem.on('change',fn) at line 307

can i make a pull request after properly testing it out?

htalat avatar Jun 30 '17 16:06 htalat

@htalat sure , much appreciated

adonespitogo avatar Jul 02 '17 03:07 adonespitogo

@adonespitogo I don't understand why you have to clear the input after selecting a photo. If you are re-selecting the same one, the base64 string is already there in the model and hence no need to trigger the change event. The main feature of the directive is to get the base64 string which we already have, don't you agree?

Would you accept removing the scope._clearInput() call?

This is the current behaviour, unfortunately. I'm not sure if this "wanted" though.

This happens because after selecting a file, we change the input value to empty in order that selecting the same file will trigger a change event. See the issue here #77

I did not realize it will change the text of the button to "None selected".

htalat avatar Jul 02 '17 16:07 htalat

@htalat Please read the discussion here

I would accept removing scope._clearInput() call if you can provide alternative solution for the issue when selecting the same file

adonespitogo avatar Jul 02 '17 19:07 adonespitogo

ah, it seems that the only way to trigger the change event is to clear the input. So i'll then make the change on my fork then since it fits my use case.

thanks for your time! :)

htalat avatar Jul 03 '17 05:07 htalat

#108

adonespitogo avatar Aug 04 '17 17:08 adonespitogo