File Uploading

B

Brian Pittman

Hi,

When uploading a file it tells me that the HasFile property is false
even though a file has been selected through the FileUpload control.
What is even stranger is it uploads the file to root of the web folder
and created a zero byte file with the file name in the directory specified.

Below is the code I used to upload the file.

if (file.HasFile)
{
file.SaveAs(Server.MapPath("\\files\\") + file.FileName);
}

Basic code, but should work none the less. I have created many apps
that required uploading, this is the first time I have encountered this
problem. Though I have just switched to VS 2008 and Vista Ultimate.
Perhaps one of these could be the problem?

Regards,

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top