Here is my javascript code.

function multyTypeUploadAttachments(file,classId,splAttrId){

    var campaignID = $('#wk_custCampID').val();
    if(campaignID == ""){
        var campaignID = $('#wk_edit_camp_ID').val();
    }
    var fileName = $('#'+file.id).val().replace(/C:\\fakepath\\/i, '');//form_skuAttachment
    var lastChar = file.id[file.id.length -1];
    var upload_data = new FormData($('#wk_multy_form_AttrOptionAttachment'+classId+"-"+splAttrId+"-"+lastChar)[0]);

    $.ajax({
        url: BASEPATH + 'c_workOrder/uploadSKUAttachments/'+file.id+'/'+campaignID,
        type: 'POST',
        data: upload_data,
        mimeType: "multipart/form-data",
        contentType: false,
        cache: false,
        processData: false,
        success: function (res) {

            $('#'+file.id+'-hidden').val(res);
            $('#'+file.id+'-OrgNamehidden').val(fileName);

            toastr.success('Upload success');
            return;

        },
        error: function (res) {
            toastr.error(res);
        }
    });
}

and here is php code

function uploadSKUAttachments($file,$campaignID){  
        $ext = substr(strrchr(basename($_FILES[$file]["name"]), '.'), 0);
        $fileName = basename($_FILES["$file"]["name"]);
        $name = basename($fileName,$ext);
        $createdTime = time();
        $target_dir = "./uploads/attachments/";
        $target_file = $target_dir .$campaignID."_".$name."_".$createdTime.$ext;
        $errorFlag = 1;
        $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
        $fullFineName= $name."_".$createdTime.$ext;

        if ($errorFlag == 1) {
            if(file_exists($target_file)){
                echo true;
            }else if (move_uploaded_file($_FILES["$file"]["tmp_name"], $target_file)) {
                echo $fullFineName;
            } else {
                echo "Sorry, there was an error uploading your file";
            }
        }
    }

And the error I get is as follows:

    Severity: Notice

Message: Undefined index: wk_multy_AttachmentDiv-6-10

Filename: controllers/C_workOrder.php

Line Number: 83

Sorry, there was an error uploading your file

Please upload the file C_workOrder.php

It says the error is on line 83, but the PHP code you are showing us only has 21 lines, so we can't investigate line 83 for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.