vostro Posted March 1, 2012 Report Share Posted March 1, 2012 (edited) Sveiki visiem! Vai ir iespējams šādā veidā dabūt failu mapē uploads ? HTML <form action="#" method="post" enctype="multipart/form-data"> <label for="file">Bilde:</label> <input type="file" name="file" id="file" /> <br /> </form> JS $('#file').change(function (){ var photo = $('#file').val(); $.post ('/welcome/upload', {photo:photo}, function (data){ alert (data); }); Ja kāds var palīdzēt, uzrakstat darbību PHP pusē, ja tas ir vispār iespējams, bez 'submit' pogas. PHP move_uploaded_file nemet mapē uploads Edited March 1, 2012 by vostro Quote Link to comment Share on other sites More sharing options...
briedis Posted March 1, 2012 Report Share Posted March 1, 2012 Ar ajax nevar augšuplādēt failus. Quote Link to comment Share on other sites More sharing options...
vostro Posted March 2, 2012 Author Report Share Posted March 2, 2012 Skaidrs! Quote Link to comment Share on other sites More sharing options...
Kracker Posted March 2, 2012 Report Share Posted March 2, 2012 (edited) pamēģini aizstāt $.post... ar $.post("upload.php", {photo:""+photo+""}, function(data){ $('#dati').html(data); }); iekš <div id="dati"></div> atgriezīs kādu info. Un Upload.php if(isset($_POST["photo"])) { //Upload kods un direktorija kur upload } Pamēģini šādi varbūt. Edited March 2, 2012 by Kracker 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.