Uploading Files Using Javascript: Can't Access File Collection On Server

P

pbd22

Hi.

I am having a really tough time here and would appreciate some help.

i am using an iFrame to pass a url string of files to upload to server.

on the client i have created a multiple upload javascript using the
below link:

http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/

and a way of constructing an iFrame and passing the file upload params
to the server using this link:

http://developer.apple.com/internet/webcontent/iframe.html

and, then, server code for processing the uploaded files using the
below code:
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)
Dim fileSize As Integer = postedFile.ContentLength

Dim files As New ArrayList
'make sure it is not blank
If Not postedFile.FileName.Equals("") Then


files.Add(System.IO.Path.GetFileName(postedFile.FileName))

'Save File to the proper directory
'postedFile.SaveAs(Request.MapPath("folder/") +
System.IO.Path.GetFileName(postedFile.FileName))

End If

Next iFile



so:

1. files are uploaded via javascript
2. files are passed through a dynamically created iframe to the server
3. the server code is executed
4. a response on the client is executed using:
window.parent.handleResponse();


but, when i try to catch the httpfilecollection for processing, i
always get length=0 and, hence,
count=0.

my guesses/questions:

1. i have set form enctype=multipart/form-data on client.aspx, but not
on server.aspx because

server.aspx is really just 2 scripts. should the server have form tags
also?

2. according to the user, he always sees client.aspx and never sees
server.aspx. but, the

file params are sent via iframe to server.aspx for back-end processing.
is it possible that the

httpfilecollection is looking at the client.aspx url string, and not
the server.aspx url string?

i have posted this all over the internet and nobody touches this
question. please tell me where

i am being confusing (or what code you would like to see) rather than
not respond.

thank you.

peter
 

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

Top