如何接受* .csv格式的输入文件跨浏览器?

时间:2015-10-15 11:56:24

标签: html safari cross-browser

我正在使用:

#import "ViewController.h"
#import <AVKit/AVKit.h>
#import <AVFoundation/AVFoundation.h>


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)playAudio:(id)sender {
    NSURL *url = [NSURL URLWithString:@"https://path/to/my.mp3"];
    [self performSegueWithIdentifier:@"playSegue" sender:url];
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    AVPlayerViewController *viewController = (AVPlayerViewController *)segue.destinationViewController;
    viewController.player = [AVPlayer playerWithURL:(NSURL *)sender];
}

@end

适用于Chrome,Firefox,IE 10+,但不适用于Safari。 我试着用:

<input type="file" accept=".csv" />

它只是在Safari上工作。 帮助我跨浏览器。 感谢。

1 个答案:

答案 0 :(得分:7)

只需使用逗号即可)

<input type="file" accept=".csv, text/csv" />