Storing uploaded files according to node ID
You can use the File (Field) Paths module in combination with the Token module for this.


Enable module
Go to admin/structure/types/manage/your_content_type/fields/your_file_field
Make sure Enable File (Field) Paths? is enabled.
Under File (Field) Path settings you can now use e.g. myfiles/[node:nid]