ここではちょっと厚いと思うよ - pangratz/dnd-file-uploadとドラッグ&ドロップが素晴らしいなど(私はクロスブラウザーなどは知らないけど関係ない)何私は実際のアップロードを処理するための正しいPHPコードを作成することはできません。ここでHTML5ファイルのドラッグ&ドロップでファイルをアップロードする
は、ベースjsのコード
$(document).ready(function(){
$.fn.dropzone.uploadStarted = function(fileIndex, file){
var infoDiv = $("<div></div>");
infoDiv.attr("id", "dropzone-info" + fileIndex);
infoDiv.html("upload started: " + file.fileName);
var progressDiv = $("<div></div>");
progressDiv.css({
'background-color': 'orange',
'height': '20px',
'width': '0%'
});
progressDiv.attr("id", "dropzone-speed" + fileIndex);
var fileDiv = $("<div></div>");
fileDiv.addClass("dropzone-info");
fileDiv.css({
'border' : 'thin solid black',
'margin' : '5px'
});
fileDiv.append(infoDiv);
fileDiv.append(progressDiv);
$("#dropzone-info").after(fileDiv);
};
$.fn.dropzone.uploadFinished = function(fileIndex, file, duration){
$("#dropzone-info" + fileIndex).html("upload finished: " + file.fileName + " ("+getReadableFileSizeString(file.fileSize)+") in " + (getReadableDurationString(duration)));
$("#dropzone-speed" + fileIndex).css({
'width': '100%',
'background-color': 'green'
});
};
$.fn.dropzone.fileUploadProgressUpdated = function(fileIndex, file, newProgress){
$("#dropzone-speed" + fileIndex).css("width", newProgress + "%");
};
$.fn.dropzone.fileUploadSpeedUpdated = function(fileIndex, file, KBperSecond){
var dive = $("#dropzone-speed" + fileIndex);
dive.html(getReadableSpeedString(KBperSecond));
};
$.fn.dropzone.newFilesDropped = function(){
$(".dropzone-info").remove();
};
$("#dropzone").dropzone({
url : "upload.php",
printLogs : true,
uploadRateRefreshTime : 500,
numConcurrentUploads : 2
});
});
ですが、私は、などどのような方法で
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = '';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
提案を仕事にupload.php得ることができない私がする必要があるすべてはにinmageをアップロード歓迎サーバーと正常にDBに(私はドラッグを取得することができます悪い一度を保存するサーバーに移動するには、画像をドロップ&。事前に
upload.phpスクリプトがうまくいかないのでエラーは出ません) –
Aggg私は誤ってDamienからコメントを削除したと思います - ごめんなさい –
エラーメッセージ? jsコンソール/ PHPエラーログをチェックしましたか? 「うまくいきません」というのは、助けが必要な場合にはあまり役に立ちません。 –