Yes, what you need is add a Upload Custom Field and a validate method for the extension of the file, eg:
function hasExtensions(filename, exts){
return new RegExp("(" + exts.join("|").replace(/\./g, '\\.') + ')$')).test(filename);
}
cur_frm.my_field_custom(doc, cdt, cdn){
if (!doc.my_field && !hasExtensions(doc.my_field, [".pdf", ".doc", ".docx"]){
doc.my_field = undefined;
cur_frm.refresh_fields();
wn.msgprint(wn._("Wrong File type"));
}
}
Adapted from: http://stackoverflow.com/questions/4234589/validation-of-file-extension-before-uploading-file
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/d3e1be09-3289-4932-9fbd-cacb9ed5fb3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yes, what you need is add a Upload Custom Field and a validate method for the extension of the file, eg:
function hasExtensions(filename, exts){ return new RegExp("(" + exts.join("|").replace(/\./g, '\\.') + ')$')).test(filename); } cur_frm.my_field_custom(doc, cdt, cdn){ if (!doc.my_field && !hasExtensions(doc.my_field, [".pdf", ".doc", ".docx"]){ doc.my_field = undefined; cur_frm.refresh_fields(); wn.msgprint(wn._("Wrong File type")); } }
Adapted from: http://stackoverflow.com/questions/4234589/validation-of-file-extension-before-uploading-file
2014-03-26 6:48 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi,Is it possible to have some kind of field that a user can use to upload a specific type of file?I want to then be able to easily access this file using the API.There will be multiple files uploaded to an item and we need to be able to retrieve them individually and I don't think that the attach file system will reliably work for me in this.
ThanksPaul
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/d3e1be09-3289-4932-9fbd-cacb9ed5fb3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a1b5041e-f68b-4530-b901-fd9e1e0d7931%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/d3e1be09-3289-4932-9fbd-cacb9ed5fb3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a1b5041e-f68b-4530-b901-fd9e1e0d7931%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/2839694f-66c3-43f2-b40a-6c7719881f98%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-user-forum/PxTzy9_7Lg8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkM8TA9JNPNwuZrej%3DP1TFYXmqhMBD0PgVHix_poXZR_fg%40mail.gmail.com.
Paul sorry, the correct option for the field are attach_files:
To check this, goto Setup > Personalize Form > Edit
Select the doctype Item and look the field Image
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CAF6a--Qkz984%2B71%3DU8-X5RfDO%3DVs0HDyaqMJiSCNPgyv2FK2tQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkPD_OOabQLPnhCiwQ%2BA8O2E8-1evSYhNNak4qjLCubKxg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CAF6a--SZ03uDHKw9HjV8M2RcoKW09704dpdthCzqZO2qVLDEyg%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/20140404130404.5308548.35818.6454%40xavierltd.com.
For more options, visit https://groups.google.com/d/optout.
From: Umair Sayyed Sent: Friday, April 4, 2014 2:43 PM To: ERPNext User's Forum Reply To: erpnext-u...@googlegroups.com Subject: Re: [erpnext-user-forum] Attachments in Email |