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 7686285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:26:40+00:00 2026-05-31T19:26:40+00:00

I am trying to upload an image from inside a JQuery modal. The form

  • 0

I am trying to upload an image from inside a JQuery modal. The form is hidden in php and once a link is clicked the modal window appears, along with a very simple form, just a file upload field

<form action="" method="post" enctype="multipart/form-data" id="uploadprofileimage"    name="uploadprofileimage">
        <label for="image">Upload a picture of the item:</label>
        <input type="file" name="image" id="image">
        </form>

However when the upload button is clicked the form is serialized and sent. To try and resolve this issue I have post back to the page and when I dump $_POST and $_FILES the arrays are empty, where am I going wrong? I have done post before when I have posted variables to PHP, but for some reason I cannot post a form!

Below is my JQuery code, hope someone can help!, Thanks

$("[href='#avatar']").click(function() {
            $("#profile-upload").dialog({
                title: 'Add a profile image',
                width: 400,
                height: 200,

                buttons:[  

                { 
                text: 'Upload',
                click: function(e) {
                    e.preventDefault();
                    var post = $("#uploadprofileimage").serialize();
                    $.post("profiles.php", post, function(data){
                        console.log(post);
                        console.log(data);


                    },'json');


                }


                },

                { text: 'Close', click: function() { $(this).dialog('close');}}



                ]


            });
    });
  • 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-05-31T19:26:42+00:00Added an answer on May 31, 2026 at 7:26 pm

    You cannot upload files using AJAX. You can however use one of many plugins that simulate AJAX action. They do this by creating an iframe in the background and submitting the data that way. Try searching for jQuery file upload plugins.

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

Sidebar

Related Questions

I'm trying to upload an image from android to a PHP server by using
i am trying to upload a image to server from iPhone application PHP code
hi all i am trying to upload image file from sdcard to php server
i am trying to upload an image from a jsp page using servlet. but
I'm trying to upload an image to my site through a form, however it's
I am trying to upload an image to the server. I hava a form
I'm currently trying to upload an image from my Mac application to Facebook. To
I'm trying to upload an image to Picasa from a Google Chrome Extension and
I am trying to implement a function in Django to upload an image from
I am trying to upload image to django from iphone with ASIFormDataRequest. in my

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.