php - function similar to move_uploaded_file() in Javascript -
hello had written code upload file. wanted write similar condition move_uploaded_file()
in javasript/jquery code or otherwise tell me how pass value javascript/jquery can insert image file in those<li>
via insertimage()
.
upload.php
<?php $name = $_files['file']['name']; $tmp_name = $_files['file']['tmp_name']; if(isset($name)) { if(!empty($name)) { $location ='images/'; if(move_uploaded_file($tmp_name, $location.$name)) {`echo '<table width="50%" border="0" cellpadding="4" cellspacing="0">';` echo '<tr>'; echo '</tr><tr>'; echo '<td align="center"><img src="images/'.$name.'" alt="resized image"></td>'; echo '</tr>'; echo '</table>'; echo "uploaded!!"; } else { echo "please choose file"; } }
jquery code
$('#addimagelink').click(function(e) {`gallery.insertimage('<li><img src="" alt=""></li>`)`}`
$('#addimagelink').click(function(e){ $.post( "upload.php", function( data ) { $("#anydiv").append(data); //gallery.insertimage('<li><img src="" alt=""></li>'); }); });
the variable data contains printed in upload.php file.
Comments
Post a Comment