Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > อยากถามครับทำยังไงให้ มันสามารถดาวน์โหลดรูปได้ทีละทั้งหมดตามที่กำหนด อันนี้มันจำกัดได้แค่ 10 รูป


[PHP] อยากถามครับทำยังไงให้ มันสามารถดาวน์โหลดรูปได้ทีละทั้งหมดตามที่กำหนด อันนี้มันจำกัดได้แค่ 10 รูป

 
Topic : 131751



โพสกระทู้ ( 37 )
บทความ ( 0 )



สถานะออฟไลน์



ข้อมูลไฟล์ที่ใช้ ด้านล่างครับ

index.php
1.<button id="download-btn" class="btn btn-primary btn-lg" data-files="imgs/1.jpg imgs/2.jpg imgs/3.jpg imgs/4.jpg imgs/5.jpg imgs/6.jpg imgs/7.jpg imgs/8.jpg imgs/9.jpg imgs/10.jpg imgs/11.jpg imgs/12.jpg imgs/13.jpg imgs/14.jpg imgs/15.jpg imgs/16.jpg ">โหลดรูปทั้งหมด</button>
2.        <script src="browser.js"></script>
3.        <script>
4.            document.querySelector('#download-btn').addEventListener('click', function (e) {
5.                var files = e.target.dataset.files.split(' ');
6.                multiDownload(files);
7.            });
8.        </script>


browser.js
01.(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.multiDownload = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
02.'use strict';
03. 
04.function fallback(urls) {
05.    var i = 0;
06. 
07.    (function createIframe() {
08.        var frame = document.createElement('iframe');
09.        frame.style.display = 'none';
10.        frame.src = urls[i++];
11.        document.documentElement.appendChild(frame);
12. 
13.        // the download init has to be sequential otherwise IE only use the first
14.        var interval = setInterval(function () {
15.            if (frame.contentWindow.document.readyState === 'complete' || frame.contentWindow.document.readyState === 'interactive') {
16.                clearInterval(interval);
17. 
18.                // Safari needs a timeout
19.                setTimeout(function () {
20.                    frame.parentNode.removeChild(frame);
21.                }, 1000);
22. 
23.                if (i < urls.length) {
24.                    createIframe();
25.                }
26.            }
27.        }, 100);
28.    })();
29.}
30. 
31.function isFirefox() {
32.    // sad panda :(
33.    return /Firefox\//i.test(navigator.userAgent);
34.}
35. 
36.function sameDomain(url) {
37.    var a = document.createElement('a');
38.    a.href = url;
39. 
40.    return location.hostname === a.hostname && location.protocol === a.protocol;
41.}
42. 
43.function download(url) {
44.    var a = document.createElement('a');
45.    a.download = '';
46.    a.href = url;
47.    // firefox doesn't support `a.click()`...
48.    a.dispatchEvent(new MouseEvent('click'));
49.}
50. 
51.module.exports = function (urls) {
52.    if (!urls) {
53.        throw new Error('`urls` required');
54.    }
55. 
56.    if (typeof document.createElement('a').download === 'undefined') {
57.        return fallback(urls);
58.    }
59. 
60.    var delay = 0;
61. 
62.    urls.forEach(function (url) {
63.        // the download init has to be sequential for firefox if the urls are not on the same domain
64.        if (isFirefox() && !sameDomain(url)) {
65.            return setTimeout(download.bind(null, url), 100 * ++delay);
66.        }
67. 
68.        download(url);
69.    });
70.}
71. 
72.},{}]},{},[1])(1)
73.});


จะทำยังไงให้มันเพิ่มจำนวนการดาวน์โหลดหรอครับ ผมกดโหลดแล้วมันได้แค่ 10 รูปเอง



Tag : PHP, JAVA

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2018-08-10 16:36:05 By : Kyxuz View : 663 Reply : 1
 

 

No. 1



โพสกระทู้ ( 9,590 )
บทความ ( 2 )



สถานะออฟไลน์


multiDownload(files);

function สีแดงมันอยู่ที่ไหน code ข้างบน หาตัวกำหนดจำนวนไฟล์ ไม่ได้
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2018-08-10 18:16:56 By : Chaidhanan
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : อยากถามครับทำยังไงให้ มันสามารถดาวน์โหลดรูปได้ทีละทั้งหมดตามที่กำหนด อันนี้มันจำกัดได้แค่ 10 รูป
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่