Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:01:48+00:00 2026-06-08T18:01:48+00:00

I am wondering why i can’t upload a file in JQuery using the $.post()

  • 0

I am wondering why i can’t upload a file in JQuery using the $.post() method?

Is there any way to tweak the request to be able to handle this?

$.post(url, { file: fileName, path: "/uploads" }, function (result) {});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:01:50+00:00Added an answer on June 8, 2026 at 6:01 pm

    I am wondering why i can’t upload a file in JQuery using the $.post() method?

    It’s because in order to upload a file you need to use multipart/form-data protocol meaning that the request body needs to be presented in a completely different manner than standard form POST which is what jQuery uses: application/x-www-form-urlencoded (a key/value pairs separated by & in the POST body). Not to mention that in order to write the file contents in the request, you need to have access to, well, the file contents, which in javascript, as you know, is not the case at all.

    But don’t lose all hopes yet. In the future, with XmlHttpRequest2 and HTML5 you will be able to upload files using AJAX.

    Until this future comes (which by the way should not be that far away, as soon as we have gotten rid of IE<=9) stick with what exists today which is: file uploading plugins that detect browsers capabilities and use XHR2 if the browser supports it and some other technology (such as hidden iframes or Flash if it doesn’t) and relieve you from the burden of doing this manually yourself.

    So go ahead, Google, and make a wishlist:

    • Blueimp
    • Plupload
    • Valums AJAX upload
    • Uploadify

    Then go ahead play with the demos, read the docs, pick one that suits your needs and try to put it into action in your site. If you encounter some specific problems don’t hesitate to ask.

    But unfortunately uploading files with $.post is a no-no for today.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering how can I generate the following array using ranges in ruby
I'm wondering how can I put a header into my PDF file, cause I've
I was wondering: can infinite loops be done in functional programming? example: when using
Just wondering can anyone tell me how to access the file field variable in
Hey guys, I'm wondering can someone help me out. I'm using javascript to serialize
I'm wondering how can I submit a form via Ajax (using prototype framework) and
I was wondering can we check the gender of the facebook users using the
I was wondering if can create some resource file which represents multiple values per
I am wondering how can i render in my header file a search model.
was wondering how can I create a sub drop down box upon selecting a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.