JS + AJAX FILE handling
I'm trying to write simple function for adding picture with AJAX use.
Unfortunatelly I don't know how to handle <input type="FILE" id="file"/>
PS. I'm not looking for ready AJAX class like JQueary..
Ps2. I'm also sending some comment information in this function...
It might be easier to upload the file using a form and then get all the information you need about the image using getImageSize()
Actually, I already have PHP script.
All I need is to:
2. Send HTTPRequesto to uploadfile.php ( I know how to send information via GET like text,... ect..)
3. Use php script and send it back to page.
I dont want to reload web site... just use AJAX. The problem is that I dont know how JS is handling file input from HTML and how I can send this input from JS to PHP.
AFAIK you cannot use the file control with javacript. You can post to an iframe by using the target attribute for the form element and then attach an onload handler to the iframe. Alternatively, you can use a flash, silverlight, or java object to upload the file.
I did as You wrote it's working fine. Unfortunatelly it is still not like I expect it to be but it is good enought