私はこれについて既に検索しています。ファイルアップロードではajaxを使用できませんが、私のファイルをajaxで処理してから、それを私のコントローラ(ディレクトリに保存するオブジェクトファイルを作成した場所)に渡すだけです。どのように私は、アップロードファイルは、AJAX mootolsトラフ処理することができ、私はすでにそれを行うとナッシングにはプラグインは、私がmootoolsでアップロードファイルを処理する方法は?
#f1_upload_process{
z-index:100;
position:absolute;
visibility:hidden;
text-align:center;
width:400px;
margin:0px;
padding:0px;
background-color:#fff;
border:1px solid #ccc;
}
</style>
<p id="f1_upload_process">Loading...<br/></p>
<p id="result"></p>
<form method="post" action="" enctype="multipart/form-data">
<label for="file">Subir un archivo</label>
<input type="file" name="file" id="fileArchivo" />
<input type="submit" name="submit" id="btnSubir" value="upload file" />
<iframe name="iframUpload" id="iframeUpload" type="file" style="display:none"></iframe>
</form>
MooToolsのは
をAJAXこれは私のコードである私にを案内するだけで誰かに必要としませんしてください、たまたま
window.addEvent("domready",function(){
cargarIndex();
});
function cargarIndex()
{
var prueboRequest = new Request({
method: 'POST',
url: '../CONTROLLER/inicio.php',
onRequest: function() {},
onSuccess: function(texto, xmlrespuesta){
document.getElementById('subirarchivo').innerHTML= texto;
$('btnSubir').addEvent('click',function(){beginUploading()});
},
onFailure: function(){alert('Error!');}
}).send();
}
function beginUploading(){
var prueboRequest = new Request({
method: 'POST',
url: '../Controller/ControllerSubirArchivo.php',
onRequest: function() {},
onSuccess: function(texto, xmlrespuesta){
onFailure: function(){alert('Error!');}
}).send();
I a lready検索が、すべて私が発見したが、これはなく、jQueryを使って、Iとはに似た何かをしたいです:ディミタールクリストフが言ったように
$(function(){
var btnUpload=$('#upload');
var status=$('#status');
new AjaxUpload(btnUpload, {
action: 'upload-file.php',
//Name of the file input box
name: 'uploadfile',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// check for valid file extension
status.text('Only JPG, PNG or GIF files are allowed');
return false;
}
status.text('Uploading...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('');
//Add uploaded file to list
if(response==="success"){
$('<li></li>').appendTo('#files').html('<img src="./uploads/'+file+'" alt="" /><br />'+file).addClass('success');
} else{
$('<li></li>').appendTo('#files').text(file).addClass('error');
}
}
});
});
}
http://mootools.net/forge/p/uploadmanager? –
ありがとう、しかし私は何を探しているのですか?あなたがjavascriptやmootools ajaxで扱う必要のあるファイルをアップロードしたいときは、私の質問にしたがって、ファイルが保存されていますが、 mootools、私は検索しましたが、何も動作していないようです –
あなたが "oncomplete"型のコールバックを何らかの形で持つことになります。 –