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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:29:58+00:00 2026-06-18T12:29:58+00:00

I want to create an uploadscript. This is my JS: $(#subUpload).live(change, function(){ var fd

  • 0

I want to create an uploadscript. This is my JS:

$("#subUpload").live("change", function(){
    var fd = new FormData();
    var file = this.files[0];
    fd.append("subUpload", file);

    $.ajax({
      type: 'POST',
      cache: false,
      url: "script.php",
      processData: false,
      contentType: false,
      data: fd,
      success: function(data){
        alert("Message: " + data);
      }
    });
});

And this is my PHP:

<?php
    if($_FILES['subUpload']['error'] == 0){
        if(is_dir('./files')){
            if(move_uploaded_file($_FILES['subUpload']['tmp_name'], '/files/'.$_FILES['subUpload']['tmp_name'])){
                echo"UPLOADED";
            }else{
                echo"FAIL";
            }
        }
        else{
            echo "Uncorrect Path";
        }
    }
    else{
        echo $_FILES['subUpload']['error'];
    }
?>

I always get the message “FAIL”.
I’ve set the folder permission to 777.
Any ideas?

  • 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-18T12:29:59+00:00Added an answer on June 18, 2026 at 12:29 pm
    bool move_uploaded_file ( string $filename , string $destination )
    

    you need to give a name to that file not just the folder

    see http://php.net/manual/fr/function.move-uploaded-file.php

     (move_uploaded_file($_FILES['subUpload']['tmp_name'], '/files/'.$_FILES['subUpload']['name'])
    

    if more problem check is_dir('/files') until you find the correct way to point to it

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

Sidebar

Related Questions

i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
here is my situation: I want to create an AJAX file-upload script, which will
I want to create a new field (or two) in my table that is
I want create a pdf using iText. The method which does this is a
Guys I want create files for check somethings, and create my owner custom rules,
I want create a function that verify if the numbers of a list fall
How to create a TIFF file in PHP? I want create a TIFF file
I want create object from Canvas3D class(in java) but my Compiler doesn't have this
I want create a command that has the following structure command path/to/some/file How do
I want create a complex jrxml file to create PDF. I want to put

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.