I have a website with the asp.net upload control and it works fine while running it on my computer, but when I upload it to the server it does not work, all that happens is the cursor continues to spin when accessed from chrome and edge on my same computer
I tried it from my mobile and it worked
This is strange, I contacted the web hosting site and it worked from there local computer
Any ideas, if not is there a simple 3rd party one I could use for single and multiple file uploads ?
Kathy the code is correct I can assure you as it works when running on my computer and from a mobile phone and the hosting companies local computer, just wondered if anybody knew this as a known issue
This is the code behind taken back to its bare minimum and still not working
If the button click event is not working, that has nothing to do with the file upload, and it seems very improbable if you have correctly wired it up to the button. (And it certainly would not work differently locally and remotely and mobile.)
After retesting my two hosted websites again with the upload control, have actually found out that they do work, but where it took seconds to upload a file for some reason on both separate sites its taking around 30 seconds, so it is actually working but
very slowly use to be much quicker
Member
6 Points
71 Posts
Upload Control Not Working
Oct 15, 2020 06:00 PM|SnookerTable|LINK
I have a website with the asp.net upload control and it works fine while running it on my computer, but when I upload it to the server it does not work, all that happens is the cursor continues to spin when accessed from chrome and edge on my same computer
I tried it from my mobile and it worked
This is strange, I contacted the web hosting site and it worked from there local computer
Any ideas, if not is there a simple 3rd party one I could use for single and multiple file uploads ?
Contributor
6061 Points
2516 Posts
Re: Upload Control Not Working
Oct 15, 2020 06:24 PM|KathyW|LINK
What code are you using to save the file?
Show us both the upload control markup in the .aspx page, and the code behind in the aspx.cs page that handles that control.
Member
6 Points
71 Posts
Re: Upload Control Not Working
Oct 15, 2020 06:51 PM|SnookerTable|LINK
Kathy the code is correct I can assure you as it works when running on my computer and from a mobile phone and the hosting companies local computer, just wondered if anybody knew this as a known issue
This is the code behind taken back to its bare minimum and still not working
protected void btnUpload_Click(object sender, EventArgs e)
{
string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Pdf/") + fileName) }
}
Member
6 Points
71 Posts
Re: Upload Control Not Working
Oct 15, 2020 07:13 PM|SnookerTable|LINK
I have deleted the code in the onclick event and put in a message instead, but this code appears to not get run, the click event is not working ?
Contributor
6061 Points
2516 Posts
Re: Upload Control Not Working
Oct 15, 2020 07:33 PM|KathyW|LINK
How did you put in a message?
The FileUpload control works just fine (used it in many sites, for many years), so there is something else going on.
You can simplify your code, by the way, by getting the filename as
string fileName = FileUpload1.FileName;
I'm not sure what the Path.GetFileName is doing there. (What does that value show when you run it?)
Contributor
6061 Points
2516 Posts
Re: Upload Control Not Working
Oct 15, 2020 11:32 PM|KathyW|LINK
If the button click event is not working, that has nothing to do with the file upload, and it seems very improbable if you have correctly wired it up to the button. (And it certainly would not work differently locally and remotely and mobile.)
How did you display the message?
Member
6 Points
71 Posts
Re: Upload Control Not Working
Oct 16, 2020 01:40 PM|SnookerTable|LINK
Kathy, thanks for your replies
After retesting my two hosted websites again with the upload control, have actually found out that they do work, but where it took seconds to upload a file for some reason on both separate sites its taking around 30 seconds, so it is actually working but very slowly use to be much quicker