Link to home
Start Free TrialLog in
Avatar of psmithphil
psmithphilFlag for United States of America

asked on

What can help AJAX handle simple file operation?

I'm using asp.net & vb.net in Visual Studio 2005 & IE6.  I have a web application that uses the FileUpload component to choose a file on the hard disk, process the file, and then return a message in the Label to indicate that the process is done.  It works fine.  But I then made it an AJAX application in order to add a simple animation with the AJAX UpdateProgress control, and it failed.  It turns out there is a Microsoft bug where several components won't work with the AJAX component, and the FileUpload component turns out to be one of them.  VERY DISAPPOINTING.  What I'm trying to do is so simple and rudimentary, but AJAX cannot handle it.  Amazing.

My Web app merely uses the path & filename from the FileUpload control and puts it in a variable, but gives the "Object reference not set to an instance of an object" when I try to do that with AJAX:
Protected Sub btnProcess_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnProcess.Click
    strDownloadDumpFile = FileUpload1.PostedFile.FileName   'Full file and path.


So it begs the question - is there another component that will give a dialog box that will work with AJAX?  I'm including a Word doc that shows the problem, but the only thing I want to know is what WILL do the simple, basic operation I want?   Thank you.
Experts-Exchange-Bug-in-MS-AJAX-.doc
Avatar of vs1784
vs1784

FileUpload control will not work with AJAX.

One possible solution is to post the file programmatically to one hidden IFRAME and then get it processed using AJAX and modify the output.

So basically upload file using some other method and other things remains as it is.

Hope it helps

Thanks
Avatar of psmithphil

ASKER

Thanks vs1784, but I'm actually not trying to upload a file, just get the path & filename into a variable.   That's all.  Then I mereley process the file.

I don't know what you mean with using a hidden IFRAME.  Could you elaborate so that I could try it?  Thank you.
AJAX can not post the file content to page and because of that you will not find anything in control, not even name of file.

By hidden IFRAME i meant that you can use one IFRAME in page which holds the same page and when you want to upload file you can post your page to that IFRAME as target so your page will not refresh and you will get the file at server too.

Hope it answers your question.

Thanks
Well, I never heard of IFRAME, so I will have to Google it and study it.  If you know some good web sites, you might let me know.  I'll get back with you to see if this worked with AJAX.

I developed this application very quickly.  But once again Microsoft's failure has turned this "Rapid Application Development" into "Very slow and time-wasting Application Development".   I shouldn't have to jump through all these hoops and waste my time due to something that should be simple and quick.

Please know I appreciate your help very much.
ASKER CERTIFIED SOLUTION
Avatar of vs1784
vs1784

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much.  I will study up on this and let you know what I discover.  I will continue with my VS&TW Application Development.
I haven't abandoned it, I just never have figured out how to get the IFRAME working.  So I don't know if vs1784's solution will work for me.  

I don't know where to go forward with this.  If your recommendation is to award points to vs1784, I am all for it.

I appreciate the experts' attempts to help me.  I'm just sorry I couldn't figure it out and respond in an appropriate manner.

And TheLearnedOne, thank you for volunteering to clean up stuff like mine.  I apologize for making work for you that you shouldn't have to do.
Forced accept.

Computer101
EE Admin