Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't upload files using ajax 1

Status
Not open for further replies.

mpartarrieu

Programmer
Nov 21, 2006
34
ES
I have a form that contains a file type input. I'm trying to pass the form input data using ajax. Have no problem with text, radio, checkbox, select or hidden type elements, but so far I've been unable to pass file type input in order to upload an image to the server. Sure I'm not the first one having this problem, but haven't been able to find anything in the forum.

If anyone could help me on this one, I'd appreciate it. A link to any good tutorial would also do the work.

Thanks in advance.

/michel

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots.

So far, the Universe is winning.
 
there may be a way to do this using IE but i'm pretty sure that's the limit. anything else would be a potential security hole would it not?
 
What do you mean by "a way to do this using IE"? I need it to work on other browsers too, but if you have any idea on how to make it work on IE please let me know...

/michel

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots.

So far, the Universe is winning.
 
1. What is your purpose in using AJAX in a file upload scenario?

2. What server side language are you using? ASP, ASP.NET and PHP all have methods for dealing with file upload.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
you can make it work on IE using an activex control which needs to be downloaded and accepted by the user.

but i may have misled you (my knowledge may be way out of date). a brief google search for ajax file upload revealed this site as one of the top hits


ability aside, i'm not entirely sure why you would want to upload something through ajax. something like java/flash etc would be better, methinks. depends, of course, on your answer to johnwm's question.
 
In response to johnwm:

1. I'm developing an application and sometimes there are two forms on the page: one on the main area and another one on the right column. Sometimes a user is working on the main area form and decides to upload an image using the right column form, but when submiting the latter form all information on the main form is lost. Thought that submiting the form using AJAX could solve the problem (and it does, but can't upload files).

2. The application was built using PHP.

Any ideas?

/michel

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots.

So far, the Universe is winning.
 
well that's easy then.

if a file upload appears, use javascript to pass the partially filled values in the other forms back into the submitted form with appropriate identifiers. then use php to determine that the forms are partially filled in and return the user to the same page with the partially completed values already filled in for the user.

 
It's always easier when we understand the question. [smile]

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
but so much more amusing when you're fumbling in the dark. ....

or that's what the bishop said to the actress.
 
Thanks for the suggestion, jpadie. I'm gonna do it that way.

Don't need it now, but still wanna know: there's no way of submiting a file within a form using ajax?

/michel

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots.

So far, the Universe is winning.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top