仅接受一个或多个html格式的文件

时间:2018-07-11 07:00:45

标签: html html5 forms input

我使用这些代码来创建接受一个或多个文件的表单。不是零文件。

<form id="uploader">
  <input type="file">
  <button type="submit"></button>
</form>

但是它不起作用。我该怎么办?

2 个答案:

答案 0 :(得分:1)

在输入字段中使用0 CoreFoundation 0x00000001117751e6 __exceptionPreprocess + 294 1 libobjc.A.dylib 0x000000010d946031 objc_exception_throw + 48 2 CoreFoundation 0x00000001117b50bc _CFThrowFormattedException + 194 3 CoreFoundation 0x00000001117a67b1 -[__NSArrayM objectAtIndexedSubscript:] + 177 4 UIKit 0x000000010ecf2957 -[UICollectionViewFlowLayout _getSizingInfosWithExistingSizingDictionary:] + 1801 5 UIKit 0x000000010ecf47db -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 136 6 UIKit 0x000000010eced70a -[UICollectionViewFlowLayout collectionViewContentSize] + 66 7 _blackened_ 0x000000010d28812f _T07beSmart22TwoSizesCellFlowLayoutC14collectionViewSC6CGSizeVSo012UICollectionI0C_So0kiG0C6layout10Foundation9IndexPathV13sizeForItemAttF + 79 8 _blackened_ 0x000000010d2882fa _T07beSmart22TwoSizesCellFlowLayoutC14collectionViewSC6CGSizeVSo012UICollectionI0C_So0kiG0C6layout10Foundation9IndexPathV13sizeForItemAttFTo + 122 9 UIKit 0x000000010ecf2e50 -[UICollectionViewFlowLayout _getSizingInfosWithExistingSizingDictionary:] + 3074 10 UIKit 0x000000010ecf47db -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 136 11 UIKit 0x000000010eced104 -[UICollectionViewFlowLayout prepareLayout] + 272 12 UIKit 0x000000010ed1a0a9 -[UICollectionViewData _prepareToLoadData] + 156 13 UIKit 0x000000010ed1a956 -[UICollectionViewData validateLayoutInRect:] + 53 14 UIKit 0x000000010ecb0620 -[UICollectionView layoutSubviews] + 260 15 UIKit 0x000000010e2b17a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515 16 QuartzCore 0x0000000114d45456 -[CALayer layoutSublayers] + 177 17 QuartzCore 0x0000000114d49667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395 18 QuartzCore 0x0000000114cd00fb _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343 19 QuartzCore 0x0000000114cfd79c _ZN2CA11Transaction6commitEv + 568 20 QuartzCore 0x0000000114cfe51a _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76 21 CoreFoundation 0x0000000111717607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 22 CoreFoundation 0x000000011171755e __CFRunLoopDoObservers + 430 23 CoreFoundation 0x00000001116fbb81 __CFRunLoopRun + 1537 24 CoreFoundation 0x00000001116fb30b CFRunLoopRunSpecific + 635 25 GraphicsServices 0x0000000113ecea73 GSEventRunModal + 62 26 UIKit 0x000000010e1e2057 UIApplicationMain + 159 27 _blackened_ 0x000000010d2896c7 main + 55 28 libdyld.dylib 0x00000001127b7955 start + 1 required属性。

multiple

示例:

<input type="file" required multiple>

答案 1 :(得分:0)

要选择多个文件,请在选择时按住CTRL或SHIFT键。

使用multiple属性。

 

<html>
  <head>
    <meta charset="utf-8">
    <title>Problem</title>
  </head>
  <body>
    <!-- Insert form here -->
    <form id="uploader">
    <input type="file" multiple>
    <button type="submit"></button>
    </form>

  </body>
</html>