Upload file

Posted on 2005-04-12
Last Modified: 2010-04-07
    I have created a application in VB .NET to upload a file to a server. I am using file field from the HTML components in my application. I am using plumtree portal to upload my code. My problem is that the file field doesnt work in plumtree, by that I mean that after selecting a file in the file field the value is not captured. It returns null value. But if I run the same code on local machine everything work fine. I would like to know is there another way selecting a file if I am not using the file field.

Question by:rahulnimje
    LVL 7

    Accepted Solution


    I think it is better to use file field and you cannot capture it from remote machine like this
     Dim saveLocation As String
        Dim fn As String
        Dim filePosted As HttpPostedFile
        Dim fullPath As String

                    fn = Path.GetFileName(YourfileFieldName.PostedFile.FileName)
                    saveLocation = Server.MapPath("./YouFolder") & "/" & fn
                    fullPath = "./Images" & "/" & fn     <---- you save this to db.
                    filePosted = YourfileFieldName.PostedFile

    hope this helps.


    Author Comment

    That's the whole issue
    when I write
     fn = Path.GetFileName(YourfileFieldName.PostedFile.FileName)

    the value in fn is NULL

    LVL 7

    Expert Comment


    culd u pls. explain the problem?


    Author Comment

    I tried to run the code on local machine and it works fine. I am using a plumtree portal to make the application available to the users. After I upload the file on plumtree portal everthing goes fine except that it gives an error

    "NULL Reference"

    It is not able to capture the value from the file field.
    I tried writing the way you told but still didnt help.


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video discusses moving either the default database or any database to a new volume.
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now