c# - Upload File from modal popup -
i have modal popup, inserting new records on database table. records inserted except upload file. neither filename inserted on database table neither file uploaded on folder. when run code on page not modal popup code works. working on localhost. code:
string myfileuploadpath; if (myattachedfile.filename != "") { fileuploadpath = "~\\myfiles\\" + myattachedfile.filename; string mypath = server.mappath(myfileuploadpath); myattachedfile.saveas(mypath); myitem.attachedfiles = myfileuploadpath; } <asp:placeholder id="placeholder1" visible="false" runat="server"> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:fileupload id="myattachedfile" runat="server" /> </contenttemplate> </asp:updatepanel> </asp:placeholder>
you can't upload file via ajax, suspect you're doing in modal popup. ways upload file posting form server (remember set multi-part/formdata), or using flash/silverlight app.
Comments
Post a Comment