Cibiņš Posted January 12, 2013 Report Share Posted January 12, 2013 Nevaru saprast kādēļ netiek atgriezti dati no JSON jeb kādēļ neatspoguļo attēlu kas augšupielādēts?? Te ir PHP uploaderis: http://paste.php.lv/0cfb7d1b2b7cee7e567364e3a2fc4958?lang=php Un te būs AJAX uploaderis: http://paste.php.lv/d4a4518223b0fc2ba6e6f937ae6f0599?lang=php Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 12, 2013 Author Report Share Posted January 12, 2013 Atvainojos, palaboju AJAX uploaderi http://paste.php.lv/99d782d6e0bb882ccd5d8f60af6371b3?lang=javascript , tagad cits errors bet to gan nevaru saprast.. FIREBUGS izmet TypeError: $(...).appendTo(...).text(...).addClass is not a functiononComplete()?pg=ca...tem=add (line 338)responseJSON = "decembris.jpg"(?)()ajaxupload.js (line 628) $('<li></li>').appendTo('#files').text(filename).addClass('error'); Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 13, 2013 Author Report Share Posted January 13, 2013 Nezin neviens? Quote Link to comment Share on other sites More sharing options...
daGrevis Posted January 13, 2013 Report Share Posted January 13, 2013 Tu izsauc jQ funkciju uz ne-jQ objekta. Meklē _why_... Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 13, 2013 Author Report Share Posted January 13, 2013 Aa ok sapratu. Renār neraudu :D Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 14, 2013 Author Report Share Posted January 14, 2013 Cik skatījos ar Firebugu JSON dati tiek izveidoti tagad, taču nedalec, kādēļ tie netiek saņemti atpakaļ $(function(){ var btnUpload=$('#upldbutton'); var status=$('#status'); new AjaxUpload(btnUpload, { action: 'resources/lib/upload-file-cart.php?upldid=<? if($item=='add'){ if($geterr==1){ echo $categories_posthash; }else{ echo $token; }} else{ if($pg=='blogs'){ echo $post_blg_cnt_hash; } else { echo $prod_prod_hash; }} ?>', name: 'uploadfile', dataType: 'json', onSubmit: function(file, ext){ if (! (ext && /^(jpg|jpeg)$/.test(ext))){ // Allowed extensions alert('Augšupielādēt atļauts tikai JPG vai JPEG tipa failus!'); return false; } status.html('<div id="msgbox3" style="margin-left: 2px; width: 351px; position: absolute; z-index: 2;"><img src="resources/template/img/warning-icon.png" width="16" height="16" alt="err_orng" style="position: absolute; margin-left: -25px; margin-top: -1px;" />UZMANĪBU: Notiek augšupielāde! <b>Lūdzu uzgaidiet!</b></div>'); }, onComplete: function(responseJSON){ status.text(''); var errormessage = responseJSON["errormessage"]; var filename = responseJSON["filename"]; //Uploaded file added to list if(errormessage==="success"){ $('<li></li>').appendTo('#files').html('<a class="img-delete delete" href="#" onclick="nos_dz(\''+filename+'\');"></a> <a class="fancyimg" href="<? echo $content_path; ?>'+filename+'"><img src="<? echo $content_path; ?>/'+filename+'" alt="" width="82" height="82" /></a>').addClass('upldimages success'); //$('#upldbutton').hide(); $('#failupload').hide(); //Function to fade-out item if delete $(function() { $(".delete").click(function() { var upldimages = $(this).parent(); var id = $(this).attr("id"); var string = 'id='+ id ; $.ajax({ type: "POST", success: function(){ upldimages.fadeOut('slow', function() {$(this).remove();}); } }); return false; }); }); alert('Augšupielāde sekmīga!'); } else if(errormessage=="exist"){ $('<li style="position: absolute; margin-left: 115px; margin-top: -19px;" id="failupload"></li>').appendTo('#files').text(filename).addClass('error'); alert('Fails '+filename+' jau eksistē!!'); } else { $('<li></li>').appendTo('#files').text(filename).addClass('error'); alert('Ehh, kautkas nogājis greizām!'); } } }); }); Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 15, 2013 Author Report Share Posted January 15, 2013 Dohh..&*^(*! Labs jautājums - priekškam ir šis forums?? :D Quote Link to comment Share on other sites More sharing options...
Kemito Posted January 15, 2013 Report Share Posted January 15, 2013 $('<li></li>').appendTo('#files').html('<a class="img-delete delete" href="#" onclick="nos_dz(\''+filename+'\');"></a> <a class="fancyimg" href="<? echo $content_path; ?>'+filename+'"><img src="<? echo $content_path; ?>/'+filename+'" alt="" width="82" height="82" /></a>').addClass('upldimages success'); Kapēc šis forums domāts? - Lai Cibiņš ar ziedinjsh, varētu turpināt izpaust savus dienišķos jokus. Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 15, 2013 Author Report Share Posted January 15, 2013 Ak jel..ja būtu sapratis kapēc tad nebūtu te bļaustījies. Izgāju cauri JSON tutorialam http://ej.uz/vznr izeksperimentējos visvisādi ar visviskautko - sanāk, bet tieši ar šo nē. :@ Te sazipota visa sūdpaka. Moš tagad kādam būs izpratne kas pa sūdu ka neatgriež datus. Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 15, 2013 Author Report Share Posted January 15, 2013 Te būs sūdpaka. uploader.zip Quote Link to comment Share on other sites More sharing options...
indoom Posted January 15, 2013 Report Share Posted January 15, 2013 chmod($filename, 0777); visdrīzāk domāts chmod($uploadfile, 0777); JSā onComplete parametri ir divi, Kā arī response tiek atgriezts kā strings, jāizmanto $.parseJSON() vispirms onComplete(file, response) { responseJSON = $.parseJSON(response); } Quote Link to comment Share on other sites More sharing options...
indoom Posted January 15, 2013 Report Share Posted January 15, 2013 Ja kas, kļūdas, ko atgriež html5 uploads, var redzēt firebug NET sadaļā, kur var redzēt POST datus. Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted January 15, 2013 Author Report Share Posted January 15, 2013 Ideāli, beidzot aizgāja!! Paldies indoom! ;) 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.