Attaching an Image of a receipt when Adding a New Expense

0
Hi.   I have this application which I made that has an Entity named "Expenses". I have desighned the form to add and edit new expenses. But I am unable to put an Image uploader to the same ADD EDIT page. What I want in simple terms is after a user enters the expense data in the ADD EXPENSE page, he should be able to add an Image by clicking the image upload and after selecting the image, he should click SAVE in the ADD EXPENSE form. And the data should be commited in the entity along with the Respective image uploaded. I have created the following Entities : * Expenses * Expense_Reciepts (Generalization System Image) The two entities are associated in a one to one. Where one Image is associated with one Expense. And I have used a Nested dataview in the ADD EXPENSE form to display the Image Upload Button. The nested dataview source is by Association. (Association is the above mentioned Association) But when Run, the image browse button stays there, nothing happens when clicked. But the other expense data fields work and saves as usual.   What Am I Doing Wrong??? or is there another way to do this?     Please Help
asked
2 answers
0

Dilan, the answer to your question is that if there is only ever one image associated with your receipt, then using a specialization of System.Images is the easiest way to go.  If you might want multiple images, then you would need a separate linked image entity.  So, for your situation, you probably do not need a separate entity to store images.

Also note that you have overcomplicated your domain model.  You have set up inheritance as System.Images >> Your.Images>> Your.Receipt.  You do not need the intermediate entity and can just inherit directly from System.Images, like
System.Images >>  Your.Receipt.

The actual images are stored in the server file system (by default in the data/files directory), not in the database.  Your receipt record contains a pointer to the uploaded file. A record is created in the System.Images entity for every record you create in the Receipts entity, but logically they are the same single record. Any action you take on the Receipts entity, like update or delete, also applies to the part of the record stored in the Images entity.

answered
3

You should add a dataview with the object Expense_Receipt inside the dataview Expenses. When creating a new object you have to make sure you create the Expense_Receipt object also and set the reference, or create a button where the new receipt object can be created. Then the upload image will work.

Regards,

Ronald

 

answered