Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:15:21+00:00 2026-06-07T16:15:21+00:00

I am using this Ajax file upload in my project and it’s working fine,

  • 0

I am using this Ajax file upload in my project and it’s working fine, my only problem is how can I save the path of the photo the I just uploaded?
basically I tried to copy the path to a TextBox control after a successful upload and surround that text box with an updatepanel and update that panel manually after calling the Ajax’s SaveAs method, but it doesn’t seem to work.

this is the code for the the uploadedComplete event:

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;
            relativeFolder = relativeFolder.Replace('\\', '/');
            var folder = Utils.RelativeWebRoot + "PostPhotos/" + relativeFolder;
            var fileName = Path.GetFileName(e.FileName);

            AsyncFileUpload1.SaveAs(Server.MapPath(folder + fileName));

            txtPostPhoto.Text = folder + fileName;
            PostImage.ImageUrl = txtPostPhoto.Text;

            PostPhotoUpdatePanel.Update();
        }
    }

txtPostPhoto is my text box.

PostImage is where I am trying to display the image preview.

is there another way of doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:15:23+00:00Added an answer on June 7, 2026 at 4:15 pm

    Try to save photopath in a ViewState

    protected void AsyncFileUpload1_UploadedComplete (object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
         ViewState["path"] = "your path"
         Page.ClientScript.RegisterHiddenField("vpath", ViewState("path"))
    }
    

    In client side place a script tag,

    <script type="text/javascript" >
        var vCode = document.getElementById("vpath");
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hii i am using ajax file upload in this code <script type=text/javascript src=fileuploader.js></script> <script
I'm using a flash/ajax file upload in php based on this site - http://blog.codeville.net/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/
So I have ajax file upload partial (using Jquery Form plugin), it's working perfectly,
I am using this ajax file upload script, and all works well in firefox
Want to upload a file using ajax for this using this uploader http://valums.com/ajax-upload/ and
I'm using FormData to ajax a file upload. The upload works, but the problem
When using Valums Ajax file uploader, how can I trigger the upload? The default
I am using Jquery form plugin to upload file in Ajax request.File is successfully
I am using Jquery form plugin to upload file in Ajax request.File is successfully
I am using http://www.phpletter.com/Our-Projects/AjaxFileUpload/ ajax file upload plugin. Is there any way of passing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.