Restrict specific file type while uploading

I am using attach field in child table

@mohitchechani I couldn’t find the reason for it not to work in child doctypes but I suspected something so I made a small change and updated the plugin. I hope that this change makes it work.

But in case if it doesn’t, please check the HTML source of the attach field and check the accept attribute of the file input. Post a screenshot if you can.

Hi,

I did as suggested, but still not working in Child Table.

Also, its working erratically in Parent Doctype. Sometimes it works, sometimes it doesn’t.

@mohitchechani I have rebuilt the Attach control and updated the plugin.

I have left some messages in the console for you to check if the plugin is being used or not.

I’m sorry for not being able to test the plugin myself because I have no access to my development laptop.

Hopefully this time everything works.

@mohitchechani In the table of child doctype, is there an Upload button bellow the table? If yes, then are you using the Upload button to upload to the child doctype?

If all the answers are yes, then changing that functionality to accept the options of allowed_file_types, etc. is somewhat impossible because the upload is not specified to a field. It’s a global upload.

But if all the answers are no, then can you please post some screenshots to show me the process.

Thanks mate!!!
Its working in Child Table now.

Just 1 lingering issue. when we run bench build it faces an error

Same error appears when we run

bench get-app https://github.com/kid1194/frappe-better-attach-control

in new bench

another issue I found after using for some time is when we click on attach and then go to select file from My Device…all files are being shown
But when close it and again click on attach, then only allowed file types are shown
Here is video showing the issue in action.

1 Like

@mohitchechani Thanks for informing me about both issues. I have fixed them both and updated the plugin.

1 Like

Thanks!!
Will check and update

The issue related to Child table doctype still persists. and bench build still gives error

@mohitchechani Regarding the build, I figured out the problem. For the child table, can you check the console and post a screenshot of it. Just to confirm, there is only one attach field in the form and that is inside the child table right?

PFA Screntshot


@mohitchechani I have updated the plugin. I think that the child table issue is because of the build error. Lets see how the plugin is going to work this time.

Still getting the build error. Also I think you updated requirement to v13, getting

Also, you updated frappe requirement to v13, getting this error when installing on v14

@mohitchechani I apologize for my silly mistake. That’s what happens when you update several plugins on the same time. I have updated the plugin.

Thanks a ton!!!

Its working great now.

@mohitchechani I’m very happy and glad that it did work finally :sweat_smile:.
Thanks for your patience and support.

1 Like

One more issue found after using it some more…when uploading files its working perfectly…But when We select from My device…its allowing to attach unsupoorted file types also.

@mohitchechani Sorry for the late reply. I checked the code and found some bugs so I fixed them and updated the plugin.

Sorry, I meant its allowing to upload unsupported file type from Library also.