Article View: pl.comp.lang.javascript
Article #51491MultiUpoad z jQuery
From: jivanmukta
Date: Sat, 10 Jan 2015 08:41
Date: Sat, 10 Jan 2015 08:41
39 lines
2997 bytes
2997 bytes
Chciałbym użyć MultiUpload z biblioteki jQuery. Chcę żeby była możliwość uploadu maksymalnie 7 plików (zmienna PHP: $maxPictures). Mój problem polega na tym, że mam przycisk do upload "Przeglądaj..." z możliwością wyboru tylko JEDNEGO pliku, a chciałbym wielu. To znaczy działa mi upload jednego pliku. Rozwiązanie oparłem na przykładach z Internetu. Może ktoś z Was ma doświadczenia z MultiUpload i będzie wiedział co jest źle.
W głównym widoku mam:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script src="http://github.com/fyneworks/multifile/blob/master/jQuery.MultiFile.min.js" type="text/javascript" language="javascript"></script>
...
$(document).ready(function () {
announcementEventHandlers(<?php echo $maxPictures; ?>);
}
...
function announcementEventHandlers(maxPictures) {
...
$('#property_pictures').MultiFile({
max: maxPictures
});
}
...
<?php
$exts = (IMAGE_EXTS . '|' . MOVIE_EXTS);
if ($maxPictures > 0) {
echo "<input multiple='multiple' type='file' name='property_pictures[]' class='multi' maxlength='$maxPictures' accept='$exts'>";
echo myFormError('property_pictures');
}
?>
Próbowałem również:
echo "<input multiple='multiple' type='file' name='property_pictures[]'
class='multi' size='$maxPictures' accept='$exts'>";
albo:
echo "<input multiple='multiple' type='file' name='property_pictures[]' class='multi max-$maxPictures' accept='$exts'>";
ale też nie działa, tzn. nadal tylko jeden plik.
Technical Details
Message-ID:
<0be64c9b-8204-4013-b9d8-4218e16026f2@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin3!goblin.stu.neva.ru!news.ripco.com!news.glorb.com!h15no2543304igd.0!news-out.google.com!qk8ni2671igc.0!nntp.google.com!dc16no558262qab.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Received: by 10.66.120.193 with SMTP id le1mr14211930pab.40.1420879269677; Sat, 10 Jan 2015 00:41:09 -0800 (PST) X-Received: by 10.140.106.8 with SMTP id d8mr10193qgf.7.1420879269524; Sat, 10 Jan 2015 00:41:09 -0800 (PST) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin3!goblin.stu.neva.ru!news.ripco.com!news.glorb.com!h15no2543304igd.0!news-out.google.com!qk8ni2671igc.0!nntp.google.com!dc16no558262qab.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: pl.comp.lang.javascript Date: Sat, 10 Jan 2015 00:41:09 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=89.73.80.243; posting-account=Fd8BNwoAAACl8PCi6-fI0bkHGOgt6LMa NNTP-Posting-Host: 89.73.80.243 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0be64c9b-8204-4013-b9d8-4218e16026f2@googlegroups.com> Subject: MultiUpoad z jQuery From: jivanmukta@poczta.onet.pl Injection-Date: Sat, 10 Jan 2015 08:41:09 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit