Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function addFormField() {
- var id = document.getElementById("id").value;
- $("#divTxt").append("<dl id='row" + id + "'><dt><label for='txt" + id + "'>Seçenek </dt><dd><input type='text' class='text' size='20' name='txt[]' id='txt" + id + "'><input type='file' name='pollimg[]' id='img" + id + "'>  <a href='#' onClick='removeFormField("#row" + id + ""); return false;'>Sil</a></dd><dl>");
- id = (id - 1) + 2;
- document.getElementById("id").value = id;
- }
- function removeFormField(id) {
- $(id).remove();
- }
- </script>
- <? // Загрузка и обработка изображения
- if (!empty($_FILES['pollimg']['name'][$i]) && $_FILES['pollimg']['error'][$i] === 0) {
- require_once 'class.upload.php';
- $handle = new Upload(array(
- 'name' => $_FILES['pollimg']['name'][$i],
- 'type' => $_FILES['pollimg']['type'][$i],
- 'error' => $_FILES['pollimg']['error'][$i],
- 'tmp_name' => $_FILES['pollimg']['tmp_name'][$i],
- 'size' => $_FILES['pollimg']['size'][$i]
- ));
- if ($handle->uploaded) {
- $handle->mime_check = TRUE;
- $handle->allowed = array('image/jpeg', 'image/gif', 'image/png');
- $handle->no_script = true;
- $handle->image_x = 480;
- $handle->image_y = 360;
- $handle->image_resize = true;
- $handle->image_ratio_fill = true;
- $handle->file_max_size = '5000000';
- $handle->file_name_body_pre = time() . '_';
- $handle->image_background_color = '#FFFFFF';
- $handle->image_watermark = '../../uploads/files/watermark.png';
- $handle->process('../../uploads/polls/');
- if (($thumb_result = $handle->processed)) {
- $thumb_width = $handle->image_dst_x;
- $thumb_height = $handle->image_dst_y;
- $anketresim = $handle->file_dst_name;
- } else {
- $anketresim = '';
- $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;
- echo '<script type="text/javascript">alert("' . $err . '");</script>';
- }
- } else {
- $anketresim = '';
- }
- } else {
- $anketresim = '';
- }
- mysql_query("INSERT INTO pollAnswers (pollID,pollAnswerValue,pollAnswerImg) VALUES ('$anketid','$sec','$anketresim') ") or die(mysql_error());
- }
- ?>
Add Comment
Please, Sign In to add comment