Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Batch migration CSV Problem


Hi,

I am importing videos with csv file into jwplatform with api.

am using sample code of jwplatform and its worked fine when i use it in windows and not working on mac.

The problem is,
Whenever there is a comma(,) in the field data then it is not parsing the rows correctly

am using this sample code

if(!empty($csv_filepath) && file_exists($csv_filepath)) {
$csv_rows = array_map('str_getcsv', file($csv_filepath));
//echo "<pre>";
//print_r($csv_rows);
$fields = array_shift($csv_rows);
//print_r($fields);
foreach($csv_rows AS $idx => $video) {
$video_meta = array_combine($fields, $video);
$upload_params = array();

etc


so am getting array_combine warnings and array is not parsing correctly and not importing videos correctly on windows and mac.

please advise me.

Thanks
Praveen

1 Community Answers

Cooper Reid

JW Player Support Agent  
0 rated :

Hi Praveen,

Values in the CSV that contain commas show be enclosed by a double quote ("). Example

tags
“outdoors, sports, nature”

You can also define the enclosure character in PHP if you wish to use something different:
http://php.net/str_getcsv

-Cooper

This question has received the maximum number of answers.