ziedinjsh Posted January 30, 2011 Report Share Posted January 30, 2011 nesaprotu kapēc neiet: headrī <script type="text/javascript" > $(function(){ var btnUpload=$('#upload'); var status=$('#status'); new AjaxUpload(btnUpload, { action: 'fcs/upload.php', name: 'avatar', onSubmit: function(file, ext){ if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){ // extension is not allowed status.text('Only JPG, PNG or GIF files are allowed'); return false; } status.html('<img src="img/loader.gif">'); }, 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="avatars/'+file+'" alt="" /><br />'+file).addClass('success'); } else{ $('<li></li>').appendTo('#files').text(file).addClass('error'); } } }); }); </script> upload.php: $uploaddir = 'avatars/'; $file = $uploaddir . basename($_FILES['avatar']['name']); if (move_uploaded_file($_FILES['avatar']['tmp_name'], $file)) { echo "success"; } else { echo "error"; } bet bildes viņš nelādē iekšā! Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 30, 2011 Report Share Posted January 30, 2011 Nav ne jausmas kas tas par AjaxUpload un kādēļ tur to vispār vajag + kādēļ tam vajag izpildīties pie document.ready nevis pie pogas nospiešanas, piemēram + vēl daudz kas, bet nu lai vai kā...ar AJAX upload'ēt nevar. Šaubos vai pats to esi rakstītjis. Mēģini vismaz domāt līdzi tam ko kopē... Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted January 31, 2011 Author Report Share Posted January 31, 2011 tur jau nebija ko domāt.. tā vnk ir teikts! rekur links uz adresi Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 31, 2011 Report Share Posted January 31, 2011 Tev shis ir izdariits? For this tutorial, i’ll be using latest version of jQuery and Ajax upload library by Andrew Valums. Grab both libraries and add them to your page header Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.