SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Upload file and send through ajax form

    Hello there,

    I use an element attached in this zip (assets file is missing due to the file size and i don't think its necessary for what i need to ask).

    Its actually a button with a pop up form, where the user fills in the name, lastname, e-mail and e-mail confirmation, telephone(optional), question/comment, send copy to my e-mail fields.

    Inside this, i need to add an extra field, where the user can upload his/her cv (doc, docx, txt, rtf, pdf file types) and when click on send the user will receive the CV file also along with the other information.

    I tried to add an Upload field called cv inside the code, but when i click on send, i have message:
    Invalid file type
    but the message is sent and at the e-mail i see all the info but i see the file name of cv, not the file.

    Any help with this please?A friend of mine that took a look told me that this form sends info via ajax and that i have to change the way that the information is being sent in order to be able to send the file.

    Thank you in advance
    Attached Files Attached Files

  2. #2
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many say its not possible, others say you can by converting the file to a string and sending it, but there are loads of "plugins" which will do it for you, here was the first I came across: http://www.dropzonejs.com/

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,052
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    The standard way send files over http with javaScript is to use a iframe as a proxy to the server-side logic used to handle the file. If you search google using those terms something should turn up. I believe there are other more modern methods but they aren't backward compatible with older versions of IE where as the iframe method is compatible all around.

    From a quick search this link explains the iframe method ok:
    http://www.alfajango.com/blog/ajax-f...iframe-method/
    The only code I hate more than my own is everyone else's.


Tags for this Thread

Bookmarks

Posting Permissions

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