форум vBSupport.ru > vBulletin > vBulletin 3.8.x > Вопросы по vBulletin 3.8
Register Меню vBsupport Изображения Files Manager О рекламе Today's Posts Search
  • Родная гавань
  • Блок РКН снят
  • Premoderation
  • For English speaking users
  • Каталог Фрилансеров
  • If you want to buy some product or script
  • Администраторам
VBsupport перешел с домена .ORG на родной .RU Ура! Пожалуйста, обновите свои закладки - VBsupport.ru
Блок РКН снят, форум доступен на всей территории России, включая новые терртории, без VPN
На форуме введена премодерация ВСЕХ новых пользователей

Почта с временных сервисов, типа mailinator.com, gawab.com и/или прочих, которые предоставляют временный почтовый ящик без регистрации и/или почтовый ящик для рассылки спама, отслеживается и блокируется, а так же заносится в спам-блок форума, аккаунты удаляются
for English speaking users:
You may be surprised with restriction of access to the attachments of the forum. The reason is the recent change in vbsupport.org strategy:

- users with reputation < 10 belong to "simple_users" users' group
- if your reputation > 10 then administrator (kerk, Luvilla) can decide to move you into an "improved" group, but only manually

Main idea is to increase motivation of community members to share their ideas and willingness to support to each other. You may write an article for the subject where you are good enough, you may answer questions, you may share vbulletin.com/org content with vbsupport.org users, receiving "thanks" equal your reputation points. We should not only consume, we should produce something.

- you may:
* increase your reputation (doing something useful for another members of community) and being improved
* purchase temporary access to the improved category:
10 $ for 3 months. - this group can download attachments, reputation/posts do not matter.
20 $ for 3 months. - this group can download attachments, reputation/posts do not matter + adds eliminated + Inbox capacity increased + files manager increased permissions.

Please contact kerk or Luvilla regarding payments.

Important!:
- if your reputation will become less then 0, you will be moved into "simple_users" users' group automatically.*
*for temporary groups (pre-paid for 3 months) reputation/posts do not matter.
Уважаемые пользователи!

На форуме открыт новый раздел "Каталог фрилансеров"

и отдельный раздел для платных заказов "Куплю/Закажу"

Если вы хотите приобрести какой то скрипт/продукт/хак из каталогов перечисленных ниже:
Каталог модулей/хаков
Ещё раз обращаем Ваше внимание: всё, что Вы скачиваете и устанавливаете на свой форум, Вы устанавливаете исключительно на свой страх и риск.
Сообщество vBSupport'а физически не в состоянии проверять все стили, хаки и нули, выкладываемые пользователями.
Помните: безопасность Вашего проекта - Ваша забота.
Убедительная просьба: при обнаружении уязвимостей или сомнительных кодов обязательно отписывайтесь в теме хака/стиля
Спасибо за понимание
 
 
 
 
DrCustUmz
Знаток
 
DrCustUmz's Avatar
Default drag & drop upload
1

I am trying implement a drag and drop uploader in the newattachment template. I have used all variables in the default template, and everything is looking right, the hover is good when I hover a file over it. but when I release the mouse on the box it does not upload the file.

I have included all code I felt relevant that could be causing a problem. I can not figure out what the issue is.

*keep in mind this is a stripped code*

the form:
HTML Code:
<form enctype="multipart/form-data" action="newattachment.php?do=manageattach&amp;p=$postid" id="manageAttachmentForm" name="newattachment" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="manageattach" />
<input type="hidden" name="t" value="$threadid" />
<input type="hidden" name="f" value="$forumid" />
<input type="hidden" name="p" value="$postid" />
<input type="hidden" name="poststarttime" value="$poststarttime" />
<input type="hidden" name="editpost" value="$editpost" />
<input type="hidden" name="posthash" value="$posthash" />
The drop zone:
HTML Code:
<div class="upload-container" id="uploadholder">
  <input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach">
  <div class="attachment-form">
    <div class="form-group"><label for="fileInput">Select files to upload</label></div>
    <input type="file" name="attachment[]" id="fileInput" multiple />
  </div>
  <div class="js-only">
  <p class="help-block prompt">
    <span class="banner-text">Drag files here to upload</span>
    <br>or<br>
    <button class="btn btn-lg btn-default" data-action="choose-files">Select Files</button>
  </p>
  <div id="uploadStatus" style="display: none;"><i class="fal fa-spinner fa-spin"></i> Uploading files. Please wait.</div>
  <p class="help-block prompt">Maximum upload file size: 20 MB.<br><a href="#" data-toggle="modal" data-target="#uploadInfo">What can I upload?</a></p>
  </div>
</div>
The Submit button:
HTML Code:
<input type="submit" id="btnUpload" class="btn btn-lg btn-block btn-primary" name="upload" value="$vbphrase[upload]" onclick="return verify_upload(this.form);">
</form>
The Js:
Code:
<script>
$('form#manageAttachmentForm #fileInput').change( function(event) {
	$('<input />').attr('type', 'hidden')
              .attr('name', 'upload')
              .attr('value', '1')
              .appendTo('#manageAttachmentForm');
	$('form#manageAttachmentForm #uploadStatus').show();
	$('form#manageAttachmentForm').submit();
});

$('#uploadholder').on({
	'dragover dragenter': function(e) {
		$('#uploadholder .banner-text').text("Drop files here");
		$(this).addClass("holder-hover");
		e.preventDefault();
		e.stopPropagation();
	},
	'dragleave': function(e) {
		$('#uploadholder .banner-text').text("Drag files here to upload");
		$(this).removeClass("holder-hover");
	},
	'drop': function(e) {
		$('#uploadholder .banner-text').text("Drag files here to upload");
		$(this).removeClass("holder-hover");
		var dataTransfer =  e.originalEvent.dataTransfer;
		if( dataTransfer && dataTransfer.files.length) {
			fileInput.files = dataTransfer.files;
			e.preventDefault();
			e.stopPropagation();
		}
	}
});
</script>
Also, I can upload attachments manually just fine. But I cant get the drag and drop portion to work.

DrCustUmz добавил 05-25-2020 в 02:12 PM
edited the code to better target the problem

I think the problem may lay in this bit of Js, but evrything looks correct to me.
Code:
'drop': function(e) {
  $('#uploadholder .banner-text').text("Drag files here to upload");
  $(this).removeClass("holder-hover");
  var dataTransfer =  e.originalEvent.dataTransfer;
  if( dataTransfer && dataTransfer.files.length) {
    fileInput.files = dataTransfer.files;
    e.preventDefault();
    e.stopPropagation();
  }
}

Last edited by DrCustUmz : 05-25-2020 at 06:12 PM. Reason: Добавлено сообщение
Bot
Yandex Bot Yandex Bot is online now
 
Join Date: 05.05.2005
Реклама на форуме А что у нас тут интересного? =)
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT +4. The time now is 03:00 AM.


Powered by vBulletin® Version 4.x.fuck
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.