URGENT: file upload control Asp.Net

Discussion in 'ASP.NET' started by AspStudent, Dec 8, 2010.

  1. AspStudent

    AspStudent New Member

    Joined:
    Dec 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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:

    If Not IpFile.PostedFile.FileName = "" Then
    Dim intFileNameLength As Integer
    Dim strFileNamePath As String
    'Logic to find the FileName (excluding the path)
    strFileNamePath = IpFile.PostedFile.FileName
    intFileNameLength = InStr(1, StrReverse(strFileNamePath),
    "\")
    Session(
    "strFileAnimalEngNameOnly") = DateTime.Now.ToString("yyyyMMddhhmmss") + "_" + Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)
    End If

    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("strFileAnimalEngNameOnly")))


    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 :confused:


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

    thanks alot

    please help

     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice