AJAX Form .. veri göndermiyor Gönder

0 Cevap php

Merhaba,

I have been battling with this piece of code for literally days now... Would appreciate any help

The script calls the php file without a problem when the submit key is hit. However, it doesnt post the form data with it.

HTML formu

<form id="image_form" name="image_form" method="POST"

action="" enctype="multipart/form-data"> File:

JavaScipt'i

$(function() {
$(".submit").click(function() {
  var obj = document.getElementById("form_div");
  var load = document.getElementById("load");
   jQuery.ajax({
    type: "POST",
    name: "image",
    url: "upload_imagel.php",
    enctype: "multipart/form-data",
    beforeSend: function(){
     obj.style.display = 'none';
     load.innerHTML = "<img src='../images/misc/ajax-loader.gif'

/>"; }, error: function(){ alert('Error has occured'); }, timeout:5000, success: function( results ){ load.style.display = 'none'; obj.style.display = 'block'; } }) return false; }); });

PHP

Aşağıdaki boş daha sonra

$image=$_FILES['image']['name'];

Şimdiden teşekkürler


Teşekkürler to pekka I changed the following AJAX to

$(document).ready(function() { 
    var obj = document.getElementById("form_div");
    var load = document.getElementById("load");

    var options = { 
        beforeSend: function(){
             obj.style.display = 'none';
             load.innerHTML = "<img src='../images/misc/ajax-loader.gif' />";
            },
        success: function(){
             load.style.display = 'none';
             obj.style.display = 'block';
            },
        type:      'POST', 
        timeout:   5000 
    }; 

    $('#image_form').submit(function() { 
        $(this).ajaxSubmit(options); 
        return false; 
    }); 
}); 

Ancak yine aynı sorun oluyor

$image=$_FILES['image']['name'];

Hala boş: (

P.S. html form başlığı şimdi

<form id="image_form" method="POST" action="sMain/upload_image_small.php" enctype="multipart/form-data">

Ben bir şey eksik?

Teşekkürler

0 Cevap