Hello.
Is it some how possible to dynamically create a custom form, in an iFrame, with the action as "/_layouts/attachFile.aspx?ListId={12345678-1234-1234-1234-123456789012}&;ItemId=2" to add an attachment to a list item?
I tried different things but nothing seems to actually attach the file.
Or, can I override UploadAttachment() so when the user clicks a button it shows the file selector dialog directly and after they are done I get notified so I can do something?
Any ideas?
--
Use Case:
I have a list. The list has a title, description (memo), an image path, and a "read more" path. The image and "read more" path are single line of texts. The user would do one of two things: provide the URL to a file that is already online, or click "browse" to select a file to be attached to the item.
It is that last part I need help with. I can edit the NewForm.aspx to add a "<input type='file'..." but I can't figure out what I need to do then.
I can't use the default attach item because I need to know what file is for what, image or "read more". Which is why I want a button for "image" and "read more" so that after the user selects a file I can store some details that will later let me identify what file is what.
My plan was to override the "save" button so that my code runs instead of the default.
Then I would use SPServices to create the item.
Then:
- I can't use FileReader so I cannot use the AddAttachment web service
- I can't use the existing "/_layouts/attachFile.aspx" because it won't let me dynamically set the file path
- I can't seem to create my own form dynamically that would attach the file
- I can call "UploadAttachment()" but that changes screens after the user clicks "OK" I won't know so I can't save the details I need
Is it some how possible to dynamically create a custom form, in an iFrame, with the action as "/_layouts/attachFile.aspx?ListId={12345678-1234-1234-1234-123456789012}&;ItemId=2" to add an attachment to a list item?
I tried different things but nothing seems to actually attach the file.
Or, can I override UploadAttachment() so when the user clicks a button it shows the file selector dialog directly and after they are done I get notified so I can do something?
Any ideas?
--
Use Case:
I have a list. The list has a title, description (memo), an image path, and a "read more" path. The image and "read more" path are single line of texts. The user would do one of two things: provide the URL to a file that is already online, or click "browse" to select a file to be attached to the item.
It is that last part I need help with. I can edit the NewForm.aspx to add a "<input type='file'..." but I can't figure out what I need to do then.
I can't use the default attach item because I need to know what file is for what, image or "read more". Which is why I want a button for "image" and "read more" so that after the user selects a file I can store some details that will later let me identify what file is what.
My plan was to override the "save" button so that my code runs instead of the default.
Then I would use SPServices to create the item.
Then:
- I can't use FileReader so I cannot use the AddAttachment web service
- I can't use the existing "/_layouts/attachFile.aspx" because it won't let me dynamically set the file path
- I can't seem to create my own form dynamically that would attach the file
- I can call "UploadAttachment()" but that changes screens after the user clicks "OK" I won't know so I can't save the details I need