I have a <div/> tag which contains a file upload <input id="file" type="file"/> tag. I want to post the contents of the input tag to a php page using $.ajax() or $.post() but how do I grab the contents of the input tag having its type as "file"? so I can submit it using the jQuery ajax functions?
Note: My code doesn't have a <form/> tag yet. I am not sure if its mandatory to upload files. Also i've seen some workarounds using <iframe> I want to know if this can be done otherwise.
I don't want to use any plugins to do this.
A byte stream can't be part of an asynchronous request.
In other words, you can't send data using AJAX approaches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With