Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 8th, 2010, 05:02 AM
Registered User
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default URGENT Question: file upload control Asp.Net

Hi all,
I have a problem and I really need your help ASAP

I am using Asp.Net and I created the fileUpload control inside an Ajax control in order to view it in ModalPopupExtender

I have several file upload in one page, so I want the user to upload all the files and then click the save button on the page to save all information.

here is the process that I want to apply:
1. The user clicks on an upload button on the page
2. The Ajax popup extender that contains the FileUpload control appears
3. The user browses and chooses the file
4. Click submit in order to go back to the main page
5. The same process is applied on other upload buttons
6. At the end of the process, the user clicks on the save button on the main page
7. the files are saved in a folder

The following method is the method when the user clicks on the submit button in the Ajax popup extender after browsing and choosing the file:

IfNot IpFile.PostedFile.FileName = ""Then
Dim intFileNameLength AsInteger
Dim strFileNamePath AsString
'Logic to find the FileName (excluding the path)
strFileNamePath = IpFile.PostedFile.FileName
intFileNameLength = InStr(1, StrReverse(strFileNamePath), "\")
Session("strFileNameOnly") = DateTime.Now.ToString("yyyyMMddhhmmss") + "_" + Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)

This is the line of code whithin the save button method that is supose to save the file in the database:

IpFile.PostedFile.SaveAs(Server.MapPath("~\uploads \" + Session("strFileNameOnly")))

when the line of saving is whithin the submit method the file is saved but not when I want it to be saved
but when i out it in the main page save button it doesn't.. it seems like its taking the file name and creating a new empty file

pleaaase help.. its urgent.. i have a project and i really need this logic to work

thanks alot

please help

Last edited by AspStudent; December 10th, 2010 at 09:53 AM..
Old April 20th, 2011, 08:00 AM
Authorized User
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow

The problem of upload file within the AJAX is the callbacks. The AJAX uses the asynchronous callback but the file upload needs a synchronous callback that collides in saving the file. Google your issue and you'll get a plenty of solutions for this issue.


Senthil Kumar M.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter File Types in ASP.NET File Upload ramuis78 ASP.NET 2.0 Basics 2 May 31st, 2007 10:50 AM
file upload in ASP.net problem lpastor ADO.NET 1 September 15th, 2004 08:55 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.