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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:10:33+00:00 2026-06-07T21:10:33+00:00

i made one script from here but now i have problem with geting $_POST[‘file’]

  • 0

i made one script from here but now i have problem with geting $_POST[‘file’]

her is the crsipt

index.php

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="ajax.js" type="text/javascript"></script>
<style>
progress
{
    background-color:#FF0000;
    width:250px;
    min-height:2px;
    height:4px;
    border:none;
}
progress::-webkit-progress-bar-value, progress::-webkit-progress-value, progress::-moz-progress-bar, progress::progress-bar
{
    background-color:#0F0;
}
</style>
</head>

<body>
<form enctype="multipart/form-data" method="post">
    <input name="file" type="file" id="file" />
    <input type="button" value="Upload" />
</form>
<div id="prc"></div>%<br>
<progress value="0" min="0" max="100"></progress>
<div id="det"></div>
</body>
</html>

ajax.js

// JavaScript Document
$(function(){
    $(':file').change(function(){
        var file = this.files[0];
        name = file.name;
        size = file.size;
        type = file.type;
        $("#det").html("NAME: "+name+"<br/>SIZE: "+size+"<br/>TYPE: "+type);
        //your validation
    });

    $(':button').click(function(){
        var formData = new FormData($('form')[0]);
        $("#data").html(formData);
        $.ajax({
            url: 'upload.php',  //server script to process data
            type: 'POST',
            xhr: function() {  // custom xhr
                myXhr = $.ajaxSettings.xhr();
                if(myXhr.upload){ // check if upload property exists
                    myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // for handling the progress of the upload
                }
                return myXhr;
            },
            //Ajax events
            //beforeSend: beforeSendHandler,
            success: function(html) {
                $("#mess").html(html);
            },
            error:function(html) {
                $("#mess").html(html);
            },
            enctype: 'multipart/form-data',
            // Form data
            data: formData,
            //Options to tell JQuery not to process data or worry about content-type
            cache: false,
            contentType: false,
            processData: false
        });
    });
    function progressHandlingFunction(e){
        if(e.lengthComputable){
            $('progress').attr({value:e.loaded,max:e.total});
            $('#prc').html(e.loaded);
        }
    }
});

and the “upload.php” script when im geting the error

<?php
if(isset($_POST['file'])){
    echo $_POST['file'];
}else{
    echo 'file is not set';
}
?>

the resoults

NAME: ALISON LIMERICK - Where love lives.mp3
SIZE: 16584832
TYPE: audio/mp3

> file is not set

the progresbarr is working well but in php something wrong

somebody help me??

  • 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-07T21:10:35+00:00Added an answer on June 7, 2026 at 9:10 pm

    You need to use $_FILES when dealing with files uploaded using Post. You can find information about $_FILES here.

    More information can be found about handling file uploads at this link

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

Sidebar

Related Questions

I had problem in my other code and huge, but I had made one
Post-release, I have made one small change to one form in our development site
I have an image which is just made of one color ? (it could
I have to port one RPM (made for Fedora) to Ubuntu as a deb
I made a counter that counts from one to infinity and if I refresh
So here we have a Python script: Record a few seconds of audio and
I have downloaded Play Framework from GitHub and compiled it. Now I want to
This question is actually inspired from another one here on SO and I wanted
I have a jquery script that collects data from different sites and saves it
Here is some parts from a diff file generated using git diff HEAD .

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.