Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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..
Reply With Quote
  #2 (permalink)  
Old April 20th, 2011, 08:00 AM
Authorized User
Join Date: Dec 2004
Location: Madurai, Tamil Nadu, India.
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.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 02:15 AM.

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