asp.net - updating text box after ajax file upload -
I'm more use Ajax file in your project and it is working fine, my problem is the way just how I Can I save the picture I just uploaded? Basically I manually copy a successful upload to the path for a TextBox control after calling the SaveAs method of Ajax and around the text box with an UpdatePanel and tried panel to update , But it does not seem to work. This uploadedComplete code for the event: txtPostPhoto is my text box. PostImage is where I am trying to display image preview. Is there another way of doing this? to save photopath in a viewstate ,
protected void AsyncFileUpload1_UploadedComplete (object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) {System.Threading.Thread.Sleep (3000); If (AsyncFileUpload1.HasFile) {var relativeFolder = DateTime.Now.Year.ToString (CultureInfo.InvariantCulture) + Path.DirectorySeparatorChar + DateTime.Now.Month + Path.DirectorySeparatorChar; Reltivefaolder = Reltivefaolderkrepls ( '\\', '/'); Var Folder = Util Relyabweboot + "Postfoto /" + Relative Folder; Var filename = path GetFileName (e.FileName); AsyncFileUpload1.SaveAs (Server.MapPath (folder + filename)); TxtPostPhoto.Text = Folder + Filename; PostImage.ImageUrl = txtPostPhoto.Text; PostPhotoUpdatePanel.Update (); }}
Protected Zero AsyncFileUpload1_UploadedComplete Try (Object Sender, AjaxControlToolkit.AsyncFileUploadEventArgsE) {ViewState ["Path"] = "Your Path" Page Client script. Client side puts a script tag in the Registered field ("vpath", ViewState ("Path"))
Comments
Post a Comment