Sign in to follow this  
DennisB

Export - Save File On Server Not Working

Recommended Posts

I am using javascript only charting and I configured the PHP exporter for server side exporting. When you download the file to the client this works fine, I'm trying to use the same script to create a file on the server and whenever it gets triggered it just downloads the file, ignoring the exportAction "Save" in the configuration. Here is the configuration from FCExporter.php:

 

 

define ( "SAVE_PATH", "/Users/dennisbaker/work/django/resources/chartexporter/charts/" );

define ( "HTTP_URI", "/resources/chartexporter/charts/" );

define ( "OVERWRITEFILE", false );

define ( "INTELLIGENTFILENAMING", true );

define ( "FILESUFFIXFORMAT", "TIMESTAMP" )

 

The javascript for the chart is attached, as I said it works fine for downloading normally but saving to the server is not working. I tried this with a callback function and without (currently the callback is not in the script below).

chartexport.txt

Edited by DennisB

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Please make sure, you have set proper path for the following elements in the FCExporter.php file.

 

define ( "SAVE_PATH", "/Users/dennisbaker/work/django/resources/chartexporter/charts/" ) Can you set it to this and try? : define ( "SAVE_PATH", "./" )

 

And also, you would need to specify the path for this element ( "HTTP_URI", "path of the folder in which FCExporter file exists" );

 

If this does not help, feel free to revert.

Share this post


Link to post
Share on other sites

Hi,

 

Please make sure, you have set proper path for the following elements in the FCExporter.php file.

 

define ( "SAVE_PATH", "/Users/dennisbaker/work/django/resources/chartexporter/charts/" ) Can you set it to this and try? : define ( "SAVE_PATH", "./" )

 

And also, you would need to specify the path for this element ( "HTTP_URI", "path of the folder in which FCExporter file exists" );

 

If this does not help, feel free to revert.

 

Updated FCExporter to set SAVE_PATH to "./" and the HTTP_URI to the correct URL. No change.

 

Does it save it to the server when you trigger it from the menu or is there some other way you are supposed to trigger it saving?

Share this post


Link to post
Share on other sites

Hi,

 

Find attached illustration of server-side export functionality using PHP export handlers.

 

For more informational, please read more here: http://docs.fusionch...erOverview.html

 

Hope this helps.

There is no attached illustration unless you are referring to the linked documentation. I was already working from the page you linked. Everything works fine until the page "Saving exported output on server disk" at which point it doesn't work.

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Apologies for the inconvenience caused.

 

You would need to set the proper path of FCExporter file in the exportHandler attribute.(according to the location of files) under the chart element.

 

Also, you would need to set the path in FCExporter file. for ex: if you are using FCExporter.php, you would need to set path in the define("SAVE PATH,"./") function as well as in define ( "HTTP_URI", "path of the folder in which FCExporter file exists" );

 

Please try to set following attributes for exporting at server-side, under the chart element.

exportEnabled='1'

exportHandler='FCExporter file path'

exportAtClient='0'

exportAction='save/download' (you can use use save or download option here)

 

Ref. Code:

<chart ... exportEnabled='1' exportHandler='FCExporter file path' exportAtClient='0' exportAction='save'>

 

Also, please find attached illustration with this reply.

Export_PHP.zip

Share this post


Link to post
Share on other sites

I am using javascript only charting and I configured the PHP exporter for server side exporting. When you download the file to the client this works fine, I'm trying to use the same script to create a file on the server and whenever it gets triggered it just downloads the file, ignoring the exportAction "Save" in the configuration. Here is the configuration from FCExporter.php:

 

 

define ( "SAVE_PATH", "/Users/dennisbaker/work/django/resources/chartexporter/charts/" );

define ( "HTTP_URI", "/resources/chartexporter/charts/" );

define ( "OVERWRITEFILE", false );

define ( "INTELLIGENTFILENAMING", true );

define ( "FILESUFFIXFORMAT", "TIMESTAMP" )

 

The javascript for the chart is attached, as I said it works fine for downloading normally but saving to the server is not working. I tried this with a callback function and without (currently the callback is not in the script below).

 

Hi David,

 

I've currently got the same problem that you encountered above. Did you find a solution for this? If so, was it folder permissions or filepath related at all? Would appreciate any info you could offer. Many thanks

 

All the best

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Please make sure, you have set proper path for the following elements in the FCExporter.php file.

 

You would need to set proper path in parameters of ExportHandler file.

 

define("SAVE PATH,"./") function as well as in define ( "HTTP_URI", "path of the folder in which FCExporter file exists" );

 

Share this post


Link to post
Share on other sites

Hi,

 

 

define("SAVE PATH,"./") function as well as in define ( "HTTP_URI", "path of the folder in which FCExporter file exists" );

 

 

Hi Sumedh,

 

thanks for the response. Could you please confirm that the HTTP_URI needs to be where the FCExporter file resides... The comment in the code I have reads:

 

"This constant HTTP_URI stores the HTTP reference to the folder where exported charts will be saved. Please enter the HTTP representation of that folder in this constant e.g., http://www.yourdomain.com/images/."

 

Many thanks

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hey,

 

You need to set the path of the "Target Folder" where the exported images/PDF of Charts are to be saved.

 

Ref. Code:

define ( "SAVE_PATH",  "./" );//Actual path of the Target Folder Relative to the folder contained "FCExporter.php" file. 
//Here path set to current folder as image/PDF intended to save on the same folder where "FCExporter.php" file is present


define ( "HTTP_URI", "http://www.yourdomain.com/ExporterHandler/PHP/" ); //HTTP Mapping of the same path as provided in above line of code.
//Here you need to provide the path of the folder where "FCExporter.php" file is present (not necessarily)
//But if you specify some other path of the folder in your server to "SAVE_PATH", you need to specify HTTP mapping URL of that path in "HTTP_URl"

 

Hope this helps!

Edited by Sashibhusan

Share this post


Link to post
Share on other sites

Hi, thanks for the prompt reply. I think the issue is centred around the javascript-only charts...

 

I've been setting 'exportHandler' : '/path/to/file.php'. This works on your dev suite example until the renderer is changed to javascript, then it fails to export to disc as expected.

 

I think I need to be setting 'html5ExportHandler' : '/path/to/file.php'..? If so, do you have a working example using the Batik library for reference please?

 

Many thanks

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Apologies for the inconvenience.

 

Let me clarify that FusionCharts JavaScript charts, server-side exported image/PDF does not save on server, as of now.

 

Also using Batik library, only you get the feasibility that you can setup your own server for export service for JavaScript Charts and will not require any Internet connection for the Export Process. But the exported image/PDF will be saved on the client's machine only.

 

So, JavaScript Chart server-side export and then save it to the server HardDisk is currently not possible.

 

For more information on "Exporting Pure JavaScript Charts", please follow the link below:

http://docs.fusioncharts.com/charts/contents/?exporting-image/ECPureJS.html

 

Hope this helps!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this