0

jquery プラグインを使用して、指定したフォルダーにファイルをアップロードしました。アップロードは適切に行われました。必要なのは、ファイルの名前とそのパスを取得してデータベースに保存することです。私が持っている変数がわからないget that を使用するには、これが私のプラグインです。

$(function () {

    // Change this to the location of your server-side upload handler:
    var url = 'test_upload_charity.php';
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo('#files');
            });
        },
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .progress-bar').css(
                'width',
                progress + '%'
            );
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
}); 

そして私のtest_upload_charity.phpは

<?php
error_reporting(E_ALL | E_STRICT);
include "UploadHandler_charity.php";
$uploadhandlerobj=new UploadHandler_charity();

$filename_uploaded=$uploadhandlerobj->get_file_name();

$file = fopen("test123456.txt","w");
echo fwrite($file,"The file is ".$filename_uploaded);
fclose($file);



?>

UploadHandler_charity.php は

https://github.com/blueimp/jQuery-File-Upload

そのリンクでは、サーバーフォルダー内にありました

4

1 に答える 1