Need a special offer?Find out if your project fits.
+

OCSV file is not loading with Relative path

Answered
kumar asked on December 28, 2015

Hi,
I was passing ocsv file path to grid:
flexmonster.connectTo({ filename: "Data/test_table_1302383060.ocsv", dataSourceType: "ocsv" });
but it's showing error like below:
Unable to open file flexmonster/Data/test_table_1302383060.ocsv?403140321.

It seems that this file doesn't exist or 'Access-Control-Allow-Origin' header is absent in the resource requested.
but, the same file if make browseForFile=true..working fine in this case:
flexmonster.connectTo({ dataSourceType: "ocsv", browseForFile: true });
Did I miss anything when passing it as relative path? Can you please help me on this case?
Thanks & Regards,
Sunilkumar.V

2 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster December 28, 2015

Hi Sunilkumar,
 
Thank you for posting your questions here.

Message "It seems that this file doesn’t exist or ‘Access-Control-Allow-Origin’ header is absent in the resource requested." is shown in one of the following situations:

  1. 1. when there is no such a file by the URL provided. To check if it is this case please open console in your browser and check if you get 404 error in it. Chrome, for example, will show the following message: "GET http:[URL to file] 404 (Not Found)". If you see such a message, please provide the component with valid URL.
  2. 2. when you open html file with embedded component from the local folder on the computer without running it on localhost or other server. To ensure that it is this case please open console in your browser and check if you see any errors in it. In this case Chrome's console shows the following message: "XMLHttpRequest cannot load file:[URL to file]. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource." It happens because of the browser's security policy. It doesn't allow component to access to the local file.
    You have two options here:
    a. Open html file with Firefox. It doesn't have such strict security rules.
    b. Put this demo on the server like http://localhost.

Please let me know if the above information was helpful.
 
Kind regards,
Iryna

Public
kumar December 28, 2015

Hi Iryna,
Thanks for your response. Yes, I checked it. 2nd one is true. In console it's showing XMLHttpRequest error.
I will place the demo on the server and will try to access.
Thanks & Regards,
Sunilkumar.V

Please login or Register to Submit Answer