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 7823795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:22:44+00:00 2026-06-02T08:22:44+00:00

in my project i need to upload files so i decided to use the

  • 0

in my project i need to upload files so i decided to use the uploader provided by asp.net ajax controls AsyncFileUPloader control.
there are four blocks. every block contains two such uploaders
so i decided to utilize the power of asp.net web user controls.
i wrapped the required form fields in my user control called DesignUploader.ascx
now i have to put the four instances of this control on my aspx page
please refer the snap below

enter image description here

my problem starts here i have to insert the fileurl to the database and each of the block generates unique id and id value changes after uploading the file to the server. i noticed that viewstate does not work for me in case of asyncfileuploader it clears the viewstate because it does the secret postback to the server behind the scenes. now only option left for me is to use session but when user uploads the files in two blocks one after another then filepath from second/third consecutive blocks overwrite my session. i don’t know how many blocks user can use to upload the designs he may use 1 only or he may use all four.

There would be a final submit button in the bottom of the page on click of which i have to insert data to database.

so when i tried to save the data to database the session stores the value of the recently uploaded file path for all the records my problem lies here

i don’t know if i was able to describe my problem in correct manner or not please excuse me if it is not clear and post comment if required.

Note: I can not change the UI because client insists for this only 🙁

any quick work around would be appreciated much

Thanks
Devjosh

  • 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-02T08:22:45+00:00Added an answer on June 2, 2026 at 8:22 am

    I believe you saving file path to session in a wrong way and it’s impossible to recognize where is an error without code.
    All the way, in my opinion better don’t persist file path in session but use client side for that purpose instead. You can add two hidden fields to DesignUploader.ascx control and set their values in UploadedComplete event handler.

    public partial class DesignUploader : System.Web.UI.UserControl
    {
        private static readonly string AppDataPath = HttpContext.Current.Server.MapPath("~/App_Data/");
    
        public string FirstFilePath
        {
            get
            {
                return Server.UrlDecode( FirstFilePathHiddenField.Value);
            }
        }
    
        public string SecondFilePath
        {
            get
            {
                return Server.UrlDecode(SecondFilePathHiddenField.Value);
            }
        }
    
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
    
            FirstFileUpload.UploadedComplete += FirstFileUpload_UploadedComplete;
            SecondileUpload.UploadedComplete += SecondileUpload_UploadedComplete;
        }
    
        void FirstFileUpload_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
        {
            var fullPath = Path.Combine(AppDataPath, Path.GetFileName(e.FileName));
            FirstFileUpload.SaveAs(fullPath);
            SaveFilePathToHiddenField(FirstFilePathHiddenField.ClientID, fullPath);
        }
    
        void SecondileUpload_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
        {
            var fullPath = Path.Combine(AppDataPath, Path.GetFileName(e.FileName));
            SecondileUpload.SaveAs(fullPath);
            SaveFilePathToHiddenField(SecondFilePathHiddenField.ClientID, fullPath);
        }
    
        private void SaveFilePathToHiddenField(string fieldId, string pathValue)
        {
            var script = string.Format("top.$get('{0}').value = '{1}';", fieldId, Server.UrlEncode(pathValue));
            ScriptManager.RegisterStartupScript(this, this.GetType(), "setPath", script, true);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with ASP.NET project where the user can upload files to the server.
I need to upload a single image to server. The project is using .NET
I need to upload a single image to server. The project is using .NET
In my Java project I need to add versioning control to the files(Like SVN),
In my website project, I need to upload the end-user's pdf files and save
In my asp.net application, user can send/upload aspx files & those files can be
I need a flash uploader, to use it in my CMS project. I need
i am working on a project that need to upload files from iphone to
I am currently working on php project where I need to upload files, but
I have created a ASP.NET MVC site and now I need to upload it

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.