PostedFile.SaveAs not correctly saving a file

D

daokfella

I have a web usercontrol on which is a Webcontrols.FileUpload control.
I expose the PostedFile property as a readonly property of the
usercontrol. That way, a page has access to it.

However, when my page does this mycontrol.PostedFile.SaveAs(filename),
the file is not getting saved correctly. For instance, uploading a jpg
or movie file results in a file being saved with the correct name, but
the file size is only 112 bytes or so. It's like it's saving some
header information, but not the actual file. When I check the
ContentLength of the PostedFile before running SaveAs, it's only 112
bytes...even though the file was originally 23kb. What's going on?

Is there a reason this is happening? Is there some weirdness because
the PosteFile property is exposed by the usercontrol and used by the
page?
 
D

daokfella

Figured it out. I was using a third party upload httpmodule at one
time and it was still registered in the web.config and hijacking my
uploads. Removed the web.config stuff and works fine now.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top