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.
you can't send file through $.post... you can use this link to uplaod file through ajax.. http://www.uploadify.com/demos/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.