not store my attachment in my task table

this my OML

Hi,

Why do you say you are not storing the attachments? You are saving the attachment on the entity MyTask and your screens that show the attachments are reading from Attachment entity.

Regards,

Marcelo

this is my OML

Marcelo Ferreira wrote:

Hi,

Why do you say you are not storing the attachments? You are saving the attachment on the entity MyTask and your screens that show the attachments are reading from Attachment entity.

Regards,

Marcelo

but my my task table showing binary data o bytes 

and m not working with attachment  m woking with my task table where image= binary data and filename and filetype?? now my question is that how to insert picture when i add a task and want this task with attachment and showing my task with attachment



I hope your submit method is ajax submit. Make it normally submit method

Marcelo, there is also the page "uploadimage", that is saving the uploaded file to the Attachment entity.

Hafiz, first question. Are you uploading the image through this page? As Marcelo pointed out, the upload in the MyTask is saving the picture directly into the MyTask entity (Picture attribute).

If you are using the "uploadimage" page to upload the image, you have a problem, because there is no connection between "Tasks" and "Attachements".

You need an FK in the Attachments entity that points to a task into MyTask, so that you are able to retrieve the correct files from attachment to a specific task.

Solution

Hi Hafiz,

You are using Ajax Submit for saving data and as per my understanding the upload control wont work with Ajax submit. try to make it Submit it will work.

Regards,

-PJ-

Solution

By the way, Sudip hint is right.

I looked into the AddTask page and your button to save the image in the MyTask is set to AjaxSubmit. The file will be submitted to the action ONLY if the button method is set to Submit. Change it and in this page the picture will be saved correctly (hopefully).

Sudip Dey wrote:

I hope your submit method is ajax submit. Make it normally submit method


now what i do?? plzz


One more thing, Hafiz.

Having a Binary attribute in a "main" entity (one that is used constantly) is a bad practice, as this degrades performance in the database.

So, the idea of putting files in a separated entity (Attachment) is correct. You just need to connect the lines on it to the correct task, through a foreign key (FK) in the Attachment entity with MyTask Identifier data type, or if a single file can be added, you can change the Attachment primary key data type to be of MyTask data type. 

This information is in the Data Modelling Relationship presentation in Web Development Online Training.

Cheers

Hafiz, Change the Ajax Submit method of the button to Submit...

Sudip Dey wrote:

I hope your submit method is ajax submit. Make it normally submit method


now its working thanks:)