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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:44:10+00:00 2026-05-20T03:44:10+00:00

I am trying to implement file upload functionality on my site. I have created

  • 0

I am trying to implement file upload functionality on my site.

I have created the actual PHP script for uploading and this is what I’ve added to my HTML:

<form enctype="multipart/form-data" action="PHPScripts/upload.php" method="POST">
    <input type="file" id="browseButton" name="image" onchange="this.form.submit();" />
</form>

This triggers the upload.php as expected, however, this is not what I want to achieve exactly. I want to implement AJAX instead. So, when the user chooses the file, I want to trigger the JavaScript function and I want that function to call the upload.php subsequently.

But there’s a problem: How am I supposed to pass the POST parameters (i.e. $_POST["upload"] and $_FILES["image"]) to PHP function through the JavaScript? I know it’s supposed to be simple, but I’m stuck. Thanks for clarifying.

Update

Changelog explained that this is not possible in the way I imagined. My ultimate goal is to achieve the following:

  1. User browses for an image to upload.
  2. PHP uploads the image to the designated location on the server machine.
  3. (This is critical) The uploaded file is presented in a predefined tag after it has been successfully uploaded. Could you give some recommendations on how to achieve the third step? Thanks a bunch.
  • 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-20T03:44:11+00:00Added an answer on May 20, 2026 at 3:44 am

    You won’t be able to do the file upload via AJAX.

    Basically what an AJAX interception does is it serializes the values on your form (you can try $('#form_id').serialize() on your console to see what it does).

    Because the file is read from the disk, you don’t have that data available at submit time and can’t do it via AJAX like you can with regular fields.

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

Sidebar

Related Questions

With HTML 5 i am trying to implement the file upload functionality. Now if
I'm trying to implement file upload functionality in the iPhone app. Server code is
So Im trying to implement a file upload functionality where when a user uploads
I am trying to implement a multiple file upload script to codeigniter. the script
I'm trying to implement this method of making a nice form upload: www.kavoir.com/2009/02/styling-file-upload-select-input-control-input-typefile.html/ which
I'm trying to upload a file using PHP. My HTML page with the form
While trying to implement an MVC file upload example on Scott Hanselman's blog. I
I am trying to implement a RESTful API in which I have to upload
I'm trying to find a way to implement file manager functionality in an mvc
I am trying to implement a file upload solution using app engine and python.

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.