By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,980 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,980 IT Pros & Developers. It's quick & easy.

Please Help: HttpFileCollection is Always Zero.

P: n/a
hi.

i am having probs accessing the HttpFileCollection.
the count/length is always zero. i have tried getting the url
of the current form, and it checks out... looks like this:

http://www.imperialistwebsite.com/up...8%5CooTree.htm

but, when i iterate though the httpfilecollection, i always get a
length = 0 and, hence, myfiles.Count = 0.

this is an upload using javascript (not the asp:fileupload tool)
from the referring page and through a hidden iframe - could that be
mucking things up?

help very much appreciated at this point. thanks.

'get the form file collection
Dim myfiles As System.Web.HttpFileCollection =
System.Web.HttpContext.Current.Request.Files
Dim iFile As Integer

For iFile = 0 To myfiles.Count - 1

'get the posted file
Dim postedFile As System.Web.HttpPostedFile =
myfiles(iFile)

'make sure it is not blank
If Not postedFile.FileName.Equals("") Then

Upload a file from your local hard disk to the FTP site.

ftpClient.UploadFile(System.IO.Path.GetFileName(po stedFile.FileName))

End If

Next iFile

Dec 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

hi again.

is this question unusually hard or confusing? i am posting it all over
the interent
but nobody responds... i'd at least be interested in "why" i am not
getting a response
so i can adjust the question.

thanks?

pbd22 wrote:
hi.

i am having probs accessing the HttpFileCollection.
the count/length is always zero. i have tried getting the url
of the current form, and it checks out... looks like this:

http://www.imperialistwebsite.com/up...8%5CooTree.htm

but, when i iterate though the httpfilecollection, i always get a
length = 0 and, hence, myfiles.Count = 0.

this is an upload using javascript (not the asp:fileupload tool)
from the referring page and through a hidden iframe - could that be
mucking things up?

help very much appreciated at this point. thanks.

'get the form file collection
Dim myfiles As System.Web.HttpFileCollection =
System.Web.HttpContext.Current.Request.Files
Dim iFile As Integer

For iFile = 0 To myfiles.Count - 1

'get the posted file
Dim postedFile As System.Web.HttpPostedFile =
myfiles(iFile)

'make sure it is not blank
If Not postedFile.FileName.Equals("") Then

Upload a file from your local hard disk to the FTP site.

ftpClient.UploadFile(System.IO.Path.GetFileName(po stedFile.FileName))

End If

Next iFile
Dec 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.