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

  • Home
  • SEARCH
  • 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 9198731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:21:22+00:00 2026-06-17T22:21:22+00:00

I am using an example found here. Mozilla developers I am interested in this

  • 0

I am using an example found here. Mozilla developers

I am interested in this example.

function upload(postUrl, fieldName, filePath)
{
  var formData = new FormData();
  formData.append(fieldName, new File(filePath));

  var req = new XMLHttpRequest();
  req.open("POST", postUrl);
  req.onload = function(event) { alert(event.target.responseText); };
  req.send(formData);
}

But I can’t understand what goes where on this example. filePath is understandable but postUrl , fieldName I can find. I am working on image uploading on the page that has Drag and Drop zone for image uploading. How can I use this function to upload the image on my website?

  • 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-17T22:21:23+00:00Added an answer on June 17, 2026 at 10:21 pm

    Check out the FormData documentation and XMLHttpRequest documentation.

    fieldName The name of the (form) field whose data is contained in value.
    postUrl The URL to which to send the request.

    You should have a server-side endpoint that responds to the upload request.
    For example:

    upload('http://mysite.com/uploader.php', 'fileField', 'path/to/my/file.jpg');
    

    Then if you are using PHP on the server-side; you can access that field value on the server-side like this:

    $my_files = $_FILES['fileField'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the example found here: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_01 The issue is that when I specify
I'm so close! I'm using the XNA Game State Management example found here and
I am using the jQuery spinner tool found here: http://btburnett.com/spinner/example/example.html When I try using
I found an example here to create a select list with optgroups using KnockoutJS.
I found how to fix div position using jQuery. Here is an example .
I'm trying to implement this basic example found here : under the section titled
I found an example here of using rounded corners using a single image. I've
Using some example code I found here on SO , I've put together a
I'm trying to run the basic starter example for using rspec found here: http://rspec.info/
Using the repo found here: http://github.com/nkallen/screw-unit and this commit: cc41f3cf373d804b11519704faf1971370f43760 I get this screen

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.