ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Upload File field

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.

Thanks

Paul



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+un…@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.

Thanks

Paul



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+un…@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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkMxAzPds1eOZ-drrKXBog7X6_Hb9r6fOrqQuxcdP9_pMA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.

Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+un…@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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@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.

For more options, visit https://groups.google.com/d/optout.

The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:
thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+un…@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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkPY01QB7qDrcM8XoRV85w4Rt21MtrA2A%3DCyuQYWvWCBLg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Hi Maxwell,

It is v3.7.1

I've tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do. 

Am I missing that field option? Upload isn't an option in the Field Type menu. 

Thanks

Paul

On Tuesday, 1 April 2014 00:14:11 UTC+13, Maxwell wrote:
The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:
thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.

you have a fieldtype named Upload?


2014-04-02 19:59 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi Maxwell,

It is v3.7.1

I’ve tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do.

Am I missing that field option? Upload isn't an option in the Field Type menu.

Thanks

Paul

On Tuesday, 1 April 2014 00:14:11 UTC+13, Maxwell wrote:
The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:

thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@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.

For more options, visit https://groups.google.com/d/optout.

nope, it also isn't specified here: http://erpnext.org/doctype-fields

Paul Dowd

Managing Director





On 3 April 2014 14:06, Maxwell Morais <ma…@gmail.com> wrote:
you have a fieldtype named Upload?


2014-04-02 19:59 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi Maxwell,

It is v3.7.1

I’ve tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do.

Am I missing that field option? Upload isn't an option in the Field Type menu.

Thanks

Paul

On Tuesday, 1 April 2014 00:14:11 UTC+13, Maxwell wrote:
The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:

thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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-forum+un…@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.

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+un…@googlegroups.com.

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.

For more options, visit https://groups.google.com/d/optout.

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



2014-04-02 22:12 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
nope, it also isn't specified here: http://erpnext.org/doctype-fields

Paul Dowd

Managing Director





On 3 April 2014 14:06, Maxwell Morais <ma…@gmail.com> wrote:
you have a fieldtype named Upload?


2014-04-02 19:59 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi Maxwell,

It is v3.7.1

I’ve tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do.

Am I missing that field option? Upload isn't an option in the Field Type menu.

Thanks

Paul

On Tuesday, 1 April 2014 00:14:11 UTC+13, Maxwell wrote:
The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:

thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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-forum+un…@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.


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+un…@googlegroups.com.
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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.

are you referring to the "Customize Form" / "Allow Attach" tickbox??

This solution is what I'm trying to get away from!! :)

I need to upload multiple files to the Batch doc-type because we have to record multiple PDFs of different government inspections and certifications. We then needs to retrieve those inspections through the API automatically, so we need to be able to reliably reference them.

Any assistance in figuring out this issue would be awesome.

Thanks

Paul

Paul Dowd

Managing Director





On 3 April 2014 14:25, Maxwell Morais <ma…@gmail.com> wrote:

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



2014-04-02 22:12 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
nope, it also isn't specified here: http://erpnext.org/doctype-fields

Paul Dowd

Managing Director





On 3 April 2014 14:06, Maxwell Morais <ma…@gmail.com> wrote:
you have a fieldtype named Upload?


2014-04-02 19:59 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi Maxwell,

It is v3.7.1

I’ve tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do.

Am I missing that field option? Upload isn't an option in the Field Type menu.

Thanks

Paul

On Tuesday, 1 April 2014 00:14:11 UTC+13, Maxwell wrote:
The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:

thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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-forum+un…@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.


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+un…@googlegroups.com.
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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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-forum+un…@googlegroups.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.

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+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CAF6a–SZ03uDHKw9HjV8M2RcoKW09704dpdthCzqZO2qVLDEyg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

I'm refer ring how configure a Upload Field in system (see the atachment)







2014-04-02 22:49 GMT-03:00 Paul Dowd <pd…@myzealand.com>:
are you referring to the "Customize Form" / "Allow Attach" tickbox??

This solution is what I'm trying to get away from!! :)

I need to upload multiple files to the Batch doc-type because we have to record multiple PDFs of different government inspections and certifications. We then needs to retrieve those inspections through the API automatically, so we need to be able to reliably reference them.

Any assistance in figuring out this issue would be awesome.

Thanks

Paul

Paul Dowd

Managing Director





On 3 April 2014 14:25, Maxwell Morais <ma…@gmail.com> wrote:

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



2014-04-02 22:12 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
nope, it also isn't specified here: http://erpnext.org/doctype-fields

Paul Dowd

Managing Director





On 3 April 2014 14:06, Maxwell Morais <ma…@gmail.com> wrote:
you have a fieldtype named Upload?


2014-04-02 19:59 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi Maxwell,

It is v3.7.1

I’ve tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do.

Am I missing that field option? Upload isn't an option in the Field Type menu.

Thanks

Paul

On Tuesday, 1 April 2014 00:14:11 UTC+13, Maxwell wrote:
The type of the Custom Field are Upload!


Do you know what your version of ERPNext?

If it is a version less than 3.x the type are “Selecet” and in options you fill "Image"



2014-03-30 20:33 GMT-03:00 Paul Dowd <pd…@myzealand.com>:

thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.


Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

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.

Thanks

Paul



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+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.






Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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+un…@googlegroups.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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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-forum+un…@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.


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+un…@googlegroups.com.
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.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



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-forum+un…@googlegroups.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.


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+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CAF6a--SZ03uDHKw9HjV8M2RcoKW09704dpdthCzqZO2qVLDEyg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




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+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkMUTjzuOKfSQ3mCfVVvLHSy4URddL12USRtEJJ73GFO9Q%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

fantastic, thanks Maxwell.

To clarify what I've done for others, to create a upload file field you do the following:

1. Create new Custom Field and enter your name/label. 
2. Use: Field Type = Select
3. Use: Options = "attach_files:"



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+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/54f44b7b-c49b-47df-809f-cd162d555bdc%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hi @pdowd

I am doing the same as you mentioned but could not succeed. Kindly help me to solve the issue. here are my screen shots:


And when I check this field:
image

Thanks