tags:

views:

32

answers:

2

I have a file input box on my page, created by the following HTML:

<input type="file" id="imagefile" accept="image/gif" />

I'm using the file input to upload a file using the Imageshack API. The API states that I need to send the following parameter:

fileupload; (input type="file") - image or video file. Mandatory unless url parameter is specified.

I'm using the jquery $.post method, but how do I refer to the file that the user has selected in the input box? Thanks for reading.

Edit: formatted the code.

+1  A: 

Assuming that I understood your question correctly, I don't believe that this is possible through $.post or any other ajax method, since file uploads are quite heavily protected by browsers. The best method I can think of is to submit the relevant form into an invisible iframe.

goffrie
A: 

You will find a detailed working example here :

http://elliottback.com/wp/using-the-imageshack-xml-api/

Philippe