[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

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
0
psmithphil
Asked:
psmithphil
  • 4
  • 3
1 Solution
 
vs1784Commented:
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
0
 
psmithphilAuthor Commented:
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.
0
 
vs1784Commented:
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
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
psmithphilAuthor Commented:
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.
0
 
vs1784Commented:
Actually File Upload control would always have problem with AJAX.

Below are some links you might be interested in, first link uses different method i.e. XML HTTP to transfer the file. You can use it if you only want to transfer file name.

http://www.codeproject.com/KB/aspnet/AJAXUpload.aspx
http://www.webtoolkit.info/ajax-file-upload.html

Hope it helps

Thanls
0
 
psmithphilAuthor Commented:
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.
0
 
psmithphilAuthor Commented:
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.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now