I would recommend looking at BlogAttachment still as an example. You could make an UploadAttachment class similar to BlogAttachment. And then in Upload add this (similar to what BlogPost class does):
@classmethod def attachment_class(cls): return UploadAttachment And then you'd controller code that works with it, and again copying from forgeblog/main.py controller code that uses attachments should get you close. If you don't want to use that Attachment pattern, you can look at File from allura/model/filesystem.py Either way you have to save files as their own object, and then reference it or query it from your Upload class (not save it as an entire field within the Upload class) On 8/28/19 12:58 PM, Shubhankar Chowdhury wrote: > Hi Dave, > Thanks for the response. > I have a code like : > class Upload(VersionedArtifact, ActivityObject): > class __mongometa__: > name = 'upload' > type_s = 'Upload' > _id = FieldProperty(schema.ObjectId) > created_date = FieldProperty(datetime, if_missing=datetime.utcnow) > fileUpload = FieldProperty(str, if_missing='') /////// At this line i > need a change to uplolad a large file. > reported_by_id = AlluraUserProperty(if_missing=lambda: c.user._id) > assigned_to_id = AlluraUserProperty(if_missing=None) > project_id = FieldProperty(schema.ObjectId) > project_id = ForeignIdProperty('Project', if_missing=lambda: > c.project._id) > > As I have mentioned above in "fileUpload " i want to upload a file which the > user will select.I am new to GridFs, i am not able to implement using this. > > > On 2019/08/28 15:54:19, Dave Brondsema <d...@brondsema.net> wrote: >> On 8/28/19 4:35 AM, Shubhankar Chowdhury wrote: >>> How to upload a large file in mongodb using allura and ming >>> >> >> Hi Shubhankar, >> >> Since you mention Ming, it sounds like you are writing custom code for >> Allura. >> What does your code look like? And what errors or problems does it show? >> >> Most file upload code in Allura uses "attachment" classes (although you can >> go >> more low-level than that). For one example, see BlogAttachment and >> BlogAttachmentsController classes and their usages. There are a lot of >> parts, >> but that might be a good example. >> >> >> -- >> Dave Brondsema : d...@brondsema.net >> http://www.brondsema.net : personal >> http://www.splike.com : programming >> <>< >> > -- Dave Brondsema : d...@brondsema.net http://www.brondsema.net : personal http://www.splike.com : programming <><