Where do I specify upload location of files?

Hi all,

I am trying to upload and attach standard documents. For example our immigration docs are called H1b.doc and is assigned to many people, the issue is ERPNext will only keep one copy of this and not change the file name. What i’d like to do is either add a script to the upload.js which will add something like a timestamp or random character to the filename to #1 allow the same doc name to have multiple versions as it will be assigned to many users, and #2 have a more difficult to guess URL as anyone can currently take a guess and download the file.

I was thinking maybe there is a way to upload the static files to Google Cloud Storage, though that might be overkill for what we need. Any advice on how to do this would be great.


While uploading, you can also attach a web-link


Hi @rmehta,

Thanks for getting back. I’m aware of the link attachment but was hoping for a more seamless approach to this.

I suppose for the time being I could have the users submit the links to me and then manually copy a google drive link in to the document.

Is the front end of ERPNext done in Nodejs or express? I might try to take a stab at changing the filenames and would (if successful) submit a PR if you and the team are ok with it. Any advice on this would be great.

Also side note, saw you guys submitted on the /r/opensource community on reddit! Nice work

Thanks again for your continued support.

@DrTrills we are happy to accept community Pull Requests and also share the copyright. So please keep sending them.

The most elegant way to do this is use hard links but too many hardlinks in a directory makes copying a directory very memory intensive.

Thanks @rmehta I will see what I can do as far as custom code! No promises just yet, though I do want to contribute back as much as possible!

@pdvyas Thanks for linking, glad to see this is an issue that has been brought up before. I see what you’re saying with the memory intensity. I’m thinking for a quick approach to try and insert the parent doc +date+ timestamp to the file upload so that (in theory) mypic.jpg would by DrTrills2-4-15-803-mypic.jpg


Yeah, good workaround. Version 5 will also have secured file downloads.

Hi @pdvyas & ERPNext Community!

I have been working on this issue in my spare time and it seems so simple, yet I can’t get anywhere! Any guidance would be great.

I am working in https://github.com/frappe/frappe/blob/develop/frappe/utils/file_manager.py#L162 and noticed on line 162 i can change the upload folder by changing

'file_url': '/' + path


'file_url': '/otheruploadFolder' + path

which would give us soemthing like exampleerp.com/otheruploadFolder/filename.doc

My logic is adding something like


to the + path giving us something like

'file_url': '/' + path.random_string(3) 

to ultimately upload resume.doc as exampleerp.com/files/filename123.doc

Is this good? I can’t seem to get it working right. Any guidance would be great. I noticed the Frappe framework seems to be very influenced by Flask. I have been looking into the flask docu for this type of thing but still can’t get it right.

Thanks for your help and support.


Hi , it seems there hasn’t been much traction with this thread since 2015, Is there no one facing same problem as we do?

We’re trying to specify a new hard drive to store all our users uploaded files and attachments. The benefits are plenty, disk space being one of them, redundancy strategy is a second one, so far we’re able to change location of the file upload by modifying the file.py settings.

However, after that we also need to configure the folder to be able to be accessable for both private users and also public (web) users, and is kinda stuck on this part.

Will anyone be willing to help us to achieve this goal? If you know how, kindly private message me, maybe we can discuss about a certain fee for helping us perform this configuration.

can’t you just choose the link option and then select the file that already resides on that different location?

This works without any problem with any cloud storage you have but wouldn’t that just work alike with any locale file, as long you can provide a path that starts with an IP address?

I guess it would work with any NAS like Synology.