Guest User

Untitled

a guest
Feb 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. function addFormField() {
  4.  
  5. var id = document.getElementById("id").value;
  6.  
  7. $("#divTxt").append("<dl id='row" + id + "'><dt><label for='txt" + id + "'>Seçenek&nbsp;&nbsp;</dt><dd><input type='text' class='text' size='20' name='txt[]' id='txt" + id + "'><input type='file' name='pollimg[]' id='img" + id + "'> &nbsp;&nbsp<a href='#' onClick='removeFormField("#row" + id + ""); return false;'>Sil</a></dd><dl>");
  8.  
  9.  
  10.  
  11.  
  12.  
  13. id = (id - 1) + 2;
  14.  
  15. document.getElementById("id").value = id;
  16.  
  17. }
  18.  
  19.  
  20.  
  21. function removeFormField(id) {
  22.  
  23. $(id).remove();
  24.  
  25. }
  26.  
  27. </script>
  28.  
  29. <? // Загрузка и обработка изображения
  30. if (!empty($_FILES['pollimg']['name'][$i]) && $_FILES['pollimg']['error'][$i] === 0) {
  31. require_once 'class.upload.php';
  32. $handle = new Upload(array(
  33. 'name' => $_FILES['pollimg']['name'][$i],
  34. 'type' => $_FILES['pollimg']['type'][$i],
  35. 'error' => $_FILES['pollimg']['error'][$i],
  36. 'tmp_name' => $_FILES['pollimg']['tmp_name'][$i],
  37. 'size' => $_FILES['pollimg']['size'][$i]
  38. ));
  39. if ($handle->uploaded) {
  40. $handle->mime_check = TRUE;
  41. $handle->allowed = array('image/jpeg', 'image/gif', 'image/png');
  42. $handle->no_script = true;
  43. $handle->image_x = 480;
  44. $handle->image_y = 360;
  45. $handle->image_resize = true;
  46. $handle->image_ratio_fill = true;
  47. $handle->file_max_size = '5000000';
  48. $handle->file_name_body_pre = time() . '_';
  49. $handle->image_background_color = '#FFFFFF';
  50. $handle->image_watermark = '../../uploads/files/watermark.png';
  51. $handle->process('../../uploads/polls/');
  52. if (($thumb_result = $handle->processed)) {
  53. $thumb_width = $handle->image_dst_x;
  54. $thumb_height = $handle->image_dst_y;
  55. $anketresim = $handle->file_dst_name;
  56. } else {
  57. $anketresim = '';
  58. $err = 'Resminiz sadece jpg, png ya da gif formatında ve maksimum 5 mb büyüklüğünde olmalıdır. Detaylı Hata Ayrintisi:' . $handle->error;
  59. echo '<script type="text/javascript">alert("' . $err . '");</script>';
  60. }
  61. } else {
  62. $anketresim = '';
  63. }
  64. } else {
  65. $anketresim = '';
  66. }
  67.  
  68. mysql_query("INSERT INTO pollAnswers (pollID,pollAnswerValue,pollAnswerImg) VALUES ('$anketid','$sec','$anketresim') ") or die(mysql_error());
  69. }
  70. ?>
Add Comment
Please, Sign In to add comment