?
Solved

Upload file

Posted on 2005-04-12
4
Medium Priority
?
157 Views
Last Modified: 2010-04-07
Hello,
    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.

Regards,
Rahul
0
Comment
Question by:rahulnimje
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
ayha1999 earned 2000 total points
ID: 13765496
Hi,

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
                YourfileFieldName.PostedFile.SaveAs(saveLocation)

hope this helps.

ayha
0
 

Author Comment

by:rahulnimje
ID: 13765537
That's the whole issue
when I write
 fn = Path.GetFileName(YourfileFieldName.PostedFile.FileName)

the value in fn is NULL

0
 
LVL 7

Expert Comment

by:ayha1999
ID: 13768919
HI,

culd u pls. explain the problem?

ayha
0
 

Author Comment

by:rahulnimje
ID: 13774419
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.

Regards,
Rahul
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

807 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