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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:55:35+00:00 2026-05-27T06:55:35+00:00

on the server side, I’ve got these: ASPX: <form id=form1 runat=server enctype=multipart/form-data> <input type=file

  • 0

on the server side, I’ve got these:

ASPX:

<form id="form1" runat="server" enctype="multipart/form-data">
    <input type="file" id="myFile" name="myFile" />
    <asp:Button runat="server" ID="btnUpload" OnClick="btnUploadClick" Text="Upload" />
</form>

CS:

protected void btnUploadClick(object sender, EventArgs e)
{
   HttpPostedFile file = Request.Files["myFile"];
   if (file != null && file.ContentLength > 0)
   {
      string fname = Path.GetFileName(file.FileName);
      file.SaveAs(Server.MapPath(Path.Combine("~/Files/", fname)));
   }
}

Client Side app: it uses WebClient but I didn’t think this was needed for any solution since webclient is pretty simple and straight forward. Anyways, here’s the code

private void btnStart_Click(object sender, RoutedEventArgs e)
        {            

            Uri uploadAddress = new Uri("http://localhost/WebUpload/default.aspx");

                WebClient wc = new WebClient();
                wc.UploadProgressChanged += new UploadProgressChangedEventHandler(wc_UploadProgressChanged);
                wc.UploadFileCompleted += new UploadFileCompletedEventHandler(wc_UploadFileCompleted);
                wc.Credentials = CredentialCache.DefaultCredentials;

                wc.UploadFile(uploadAddress, "POST", m_filename);

        }

        void wc_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e)
        {
            if (e.Error != null)
                txtProgress.Content = e.Error.Message;
            else
                txtProgress.Content = "Completed";
        }

        void wc_UploadProgressChanged(object sender, UploadProgressChangedEventArgs e)
        {
            txtProgress.Content = String.Format("{0}% completed",
                e.ProgressPercentage);
        }

as for the client app: it’s a simple webclient using uploadfileasync via HTTP POST to the aspx page.

Question: files gets saved normally using the aspx page but for the client app, the file gets uploaded and but doesn’t get saved on the folder. What might be happening? I’m pretty sure this is a server side problem.

Update: added the client side code. The client app works on another (but asp classic) server so I’m doubting that the client is the one that needs fixing.

  • 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-05-27T06:55:36+00:00Added an answer on May 27, 2026 at 6:55 am

    Reposting my comment since Jan never posted an answer.

    Thanks to Jan for pointing me to the right direction. The file receiving code should have been in the page_load, that was careless of me. Another problem was the string name of the index of the file (Request.Files[“myFile”]) which should be of the same id as the input control in the aspx page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing server side code i finally got my eyes X-crossed trying to write -
Please examine the server-side code below. Assuming that data.id is abc77 at some instant,
Our server side validation (via data annotations) is working great and posts the errors
Task: transfer a server side binary tree to client. I got this task in
cannot access asp.net server side control from jquery Label <label id=lblClanName runat=server>Something here</label> Jquery
Server side we can authenticate the user but I want security of data when
Server side extjs form validation using zend framework I have extended Zend_Form class to
The server side gave me a .p12 certificate file which I've clicked and installed
I have a server side component (i.e. a Servlet) that creates a PDF file
I'm building a server-side application which requires the data the be stored encrypted in

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.