Results 1 to 5 of 5

Thread: JS + AJAX FILE handling

  1. #1
    Join Date
    Jun 2010

    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"/>

    What I need is to get all file information in to JS script and send it to php script to load the file. Does any body have script that could show how the FILE is handle by JAVASCRIPT ?

    PS. I'm not looking for ready AJAX class like JQueary..
    Ps2. I'm also sending some comment information in this function...

  2. #2
    Join Date
    Mar 2010
    It might be easier to upload the file using a form and then get all the information you need about the image using getImageSize()

  3. #3
    Join Date
    Jun 2010
    Actually, I already have PHP script.

    All I need is to:

    1.get info from input FILE to the javascript function
    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.

  4. #4
    Join Date
    Jan 2009
    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.

  5. #5
    Join Date
    Jun 2010
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center