The question was how to attach an attachment to a temporary case and later attach it to the case when the case is generated and not about temporary case creation . For attaching an atatchment with a case, we need to have the case id , because the pzinkey of data-work-attach table is formed based on the pzinskey of the case.
Nikhil, you can use pxFileUpload control. You can check some OOTB implementations of this control. When using this control you need to create one section that has control that executes 'PopupFileBrowser(ev)' function and an activity like @baseclass.pzUploadFile. The files selected this way are uploaded to file system but not yet saved in database. pzUploadFile activity keeps uploaded file information in Primary.pyUploadedFile clipboard page of class Data-WorkAttach-File. When you create actual case, you can use this pyUploadedFile page and attach file to case using one of the OOTB attachment activities which should be as simple as ->