Hi Experts,
In this code, only CSV file should be accepted but its taking even the .png and other image file and so on . How can i make the below code only for csv.
AsciiStreamIo file;
Array fileLines;
FileUploadTemporaryStorageResult fileUpload;
Counter counter = 0;boolean header = true; #OCCRetryCount; try { //Upload a file fileUpload = File::GetFileFromUser() as FileUploadTemporaryStorageResult; file = AsciiStreamIo::constructForRead(fileUpload.openResult()); if (file) { if (file.status()) { throw error("@SYS52680"); } file.inFieldDelimiter(','); //separator file.inRecordDelimiter('\r\n'); } //Read a CSV File container rec; ttsbegin; while(file.status() == IO_Status::Ok) //while (!file.status()) { counter++; rec = file.read(); if (conLen(rec)) { if(header == true) { header = false; //This CSV file will always have header continue; } //My code info("Import Completed"); ttscommit;
Please guide me on this.
Thanks in advance,
Mark