469,889 Members | 1,388 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

Uploading files to Web server

I've created a file uploading handler, implemented as an httpHandler. Each
time I attempt to upload a file, or files, my HttpContext.Request.Files
property never contains the files that were uploaded. Here's a snippet of
my handler code:

// *** BEGIN HANDLER CODE *** //
public class AutoUpload : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
HttpRequest request = context.Request;
HttpResponse response = context.Response;
HttpFileCollection coll = context.Request.Files;

if (request.Files.Count > 0)
{
// code to save files locally...
}
}
}
// *** END HANDLER CODE *** //

I'm posting files using the normal "<input type="file">" method and also
ensuring that my enctype is set to "multipart/form-data" Just to be as
verbose as possible, here's a snippet of the client-side code:

// *** BEGIN CLIENT CODE *** //
<form id="Form1" method="post" enctype="multipart/form-data"
action="http://localhost/UploaderService/Uploader.aspx">
<input type="file" id="txtUpload" style="WIDTH:250px">
<br>
<br>
<input type="submit" value="Post It">
</form>
// *** END CLENTCODE *** //

I've checked to make sure that I have Write permissions to the target
directory and also have Write permissions set to allowed in IIS. Is there
something I've missed here?? Thanks in advance.

-Marc


Nov 17 '05 #1
0 1032

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Chamomile | last post: by
5 posts views Thread by Kevin Ollivier | last post: by
3 posts views Thread by Dean Richardson | last post: by
7 posts views Thread by Lad | last post: by
1 post views Thread by =?Utf-8?B?RGFu?= | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.