+ Start a Discussion
prakash chaudharyprakash chaudhary 

Use server file in vfpage

Please let me know that If i upload my files like swf file or any video file on my server & I want to access that file in my vfpage then how can i use that ?

Actually In my VFPage code there is one javascript code that need one .swf file in their constuctor but when I uploaded that file in static resources then it is not working bcoz of that i want to use that file from server itself.

 

Since my constructor is like this...

var myChart = new FusionCharts("Column3D.swf",  "myChartId", "600", "400", "0", "1" );

 

This red marked text is static file which is used in constructor so can I here use my server page ?

or is their any other ways to use this file from static resources itself then let me know...

bob_buzzardbob_buzzard

"Column3D.swf" is a text string - do you know how the fusion charts constructor uses it?  The only way you can get at that file on the page is via its URL.  I wouldn't expect that to be any different for Visualforce or non-VF implementations.

prakash chaudharyprakash chaudhary

Since I dont know how fusion charts constructor uses it but I am sure that it is using as url bcoz when files are in any folder then we have to give path for that.

Since I have tried this first in Web page & it works fine with URL(server page url) but when I try to use it in Visualforce page so please let me know how to use fusion charts in my visualforce ?

 

bob_buzzardbob_buzzard

You can add the SWF as a static resource and then use the URLFOR function to produce a URL.

 

For example, I have a flash file inside in a zip uploaded as static resource, and I can generate the URL on the page via:

 

{!URLFOR($Resource.KAB_Resources, 'swfs/test.swf')}

 

prakash chaudharyprakash chaudhary

Yaa bob, I have tried that already, but the problem is,

The constructor of Fusion charts is like..

FusionCharts object = new FusionCharts('URL', param2,param3,param4);

So how can I use {!URLFOR(zipfile,filename)} instead  of URL.

I have to use any apex tag to call them.

 

bob_buzzardbob_buzzard

The URL is just a string - you can place your merge field inside the string:

 

FusionCharts object = new FusionCharts("{!URLFOR($Resource.KAB_Resource, 'swfs/test.swf')}", param2,param3,param4);

 

prakash chaudharyprakash chaudhary

I tried but not working,

Since it is flash file so might be needs <apex:flash /> tag.

Not getting any output.

bob_buzzardbob_buzzard

The URL shouldn't care what sort of content you are rendering - it merely provides the path to it.

 

Have you viewed the page source to see exactly what the URLFOR expands up to?  Can you post that.

prakash chaudharyprakash chaudhary

Since In my static resource there is no zip file of that .swf file & I uploaded directly in static resources & I used as {!$Resource.filename.swf}.

Since last time I asked for dynamically use of image from zip file & that was not working so bcoz of that i uploaded my file directly not by zip file.

Let me put that file into zip & then let me try again.