Does Flex save stuff to the local cache on client computer? - apache-flex

My Flex app downloads a bunch of images. When the user closes the browser window (or navigates away from the page), those images shouldn't be saved in the local cache. HTTP headers for the SWF file tells browser to fetch it from the website every time -- that is, it shouldn't save the SWF file locally. I just want to make sure that any of the images that the Flex app downloads isn't saved locally.
I checked Windows XP & Flash 9 for this. And nothing was stored locally. I assume this is true across all platforms and all versions of Flash greater than 9?
Thanks!

I think that flash download contents using the underling browser so the browser caches contents for him. In my experience sometimes browsers fails to read HTTP infos for caches and uses data from cache even if the file on the server is newer. The only way that works for sure to disable caching is changing the name of the file everytime you download it.
For example you can add a random string or a timestamp to your request. image1.gif is image1.gif?nocache=1231231

Related

How can I load local images from a website?

I'm making a gallery site for a client, to be used for internal use. It is browsing hi-res images, so there's literally over 1 GB of images, each 3-4 MB, so loading the images through the web isn't an option due to load time.
My idea was to store the images on each machine locally, but maintain a central database online so all machines are in sync, and load the images using "file:///C:/images/file.jpg". But apparently browsers don't allow a website to load files from the local computer (for obvious security reasons).
How can I get around this?
Do I have to create a browser plugin myself to get access to the file system?
Alternatively, is there a better way to achieve my goal of (a) a centralized database of images and data, but (b) images stored locally?
Thanks for any advice you can offer.
You can store your images in your centralized database, but it would be of interest to also store smaller, resized images so that if the user is interested in the smaller version, s/he can click it, or hover over it, and have it load the larger version. 3-4MB isn't that insane for most computers to load, so long as the page isn't trying to load them all at once.
To get access to the file system, you can use the web-host's file access links, or you can use an FTP client, given that you know the FTP username/password.

Adobe Flex; how to cache main application

Does Adobe Flex support caching of the main application; i.e. if the user had previously loaded it and it hasn't been modified since last loaded, can the browser get the swf file etc. from it's cache? I'm on an embedded system with boa as the web server, so can modify any behavior there as needed.
Thanks,
Fred
Not sure if the actually is an answer to your question, but I can tell you that the browsers will cache the swf files as long as it is referenced the same way within your html.
Ie. we use src="myApp.swf?dummy=102032" when referencing to it to avoid caching. You can use httpfox or any other networking monitor tool to see when your swf is cached.
The browser does the caching automatically just like any other file you view through it. As long as the user has a cache setup in the browser, there shouldn't be a problem unless the URL to the file changes (that includes query strings).
There is also RSL caching, if you are using RSLs. By default, they are just in your output folder as SWFs, but you can use the Adobe signed RSLs which are of the SWZ extension, are hosted on the Adobe site, and are cached at the Flash Player level, not the browser. This means that even if a user has caching disabled in the browser, it will cache the RSL either way.

Upload more than 2GB file in Asp.Net?

I am trying to upload a 2+ GB video file using FTP . When I click “Upload” button in browser control, the page is not getting post but the status in browser is DONE. The same works fine with video files less than 2GB.
I just added one page, with browser control and one button for posting the page.
Just clicked the button, to post the page with 2gb file.
The page was not posting to server.
split the file up into smaller chunks, FTP those, and then re-combine.
MSDN
edit : You can do files up to 2GB + with ASP.NET using a third party solution that overrides the built-in request checking. This will work in all versions of IIS except IIS 7 integrated mode, which has a hard 2GB limit.
Read this
Read this : http://www.webdavsystem.com/server/documentation/upload
There are limits imposed by browsers on the amount of data you can upload in a single request.
In IE I think it is 2gb.
What are you using?

When an swf (or other external remote resource) is loaded using SWFLoader, is there any client side caching performed

Would like to know if when an external remote resource (say SWF, or JPG) is loaded using the SWFLoader (or even Image component) in flex3, if there is any client side (ie. browser caching?) or the loaded resources. In particular would a second request then to access a previously accessed resource just use the cached resource or would a new request be made. It would be nice to know if both are possible (ie. telling it to always use a fresh load or to use a cached copy if it is available)
The browser is responsible for caching all externally loaded media, such as images sounds, videos and even SWFs. These can be deleted by clearing your browser cache. I recommend the Clear Cache Button Firefox Add-on for anyone testing there Flash projects in Firefox.
However, Flash Player handles caching of any externally loaded signed Flash components e.g. any Adobe Flex framework components. You can read more about Flash Players cache here. Clearing your browser cache, will not clear these components.
To stop a file being cached by your browser, you will need to make sure its filename is unique each time it is loaded. You can do this by appending a random string as a URL variable. I usually use the current time, or a random number:
var noCache:int = new Date().getTime();
myImage.load("filename.jpg?uniq=" + noCache);
Or you can add the unique variable using the URLVariables class.
If it's caching you might avoid it loading the resource with a random var. For example, loading the uri "/background.swf?var=1432".
You should empty your browser cache. This way, once everything works fine caching will still work. What means if I visit 5 times the same website I'll load it only once (that's really convinient).
The solution ktulur suggests works but remember commenting/removing it when you finish.
You could do something like:
var anticache:String="";
anticache = String(Math.random());
var file_url:String = "Whatever.xxx"+anticache;
An then comment/uncomment the second line to use/ignore the anticache method. I hope it helps :)

How do you show a preview image when allowing file uploads in ASP.NET?

Here is the functionality I want:
User selects an image from their machine, hits an Upload button (or better yet the following fires on the onchange event of the file input), and is able to see a preview of the image they are about to upload.
Here is the current workflow I am using, but it seems suboptimal:
I have an image control, a file input control and a submit button control. When the submit button is clicked, the codebehind handles the OnClick event and loads the image from the file input element. It then stores it into a temporary folder on the web server and sets the image control's ImageUrl to point to it.
This works, but results in me having to do a lot of janitorial duty in cleaning up these temporary images. Is there a cleaner workflow for doing this?
If you have memory to burn:
cache the image bytes in memory
set your ImageUrl to an image handler (.ashx) with some sort of cache identifier
serve the image bytes from cache
if the user cancels or leaves, discard the cached bytes
if the user accepts, write the cached bytes to their final destination
You should upload and rename the image to match some sort of ID for your current record. Then, when you upload a new file, delete any old ones first, all in the codebehind.
If you are only showing a thumbnail, you should try to use an image library to resize the image before saving. This will save on bandwidth and storage space.
I am assuming that the problem you are trying to solve is for your application to have the ability to preview the image before the user commits to that image. Your current approach has many advantages but one disadvantage is orphaned image files in a temporary directory if the user previews several images before committing or abandons the operation all together.
I've noticed several popular social networking sites using a different approach. Basically, a Java applet is used to do the preview operation on the user's local machine. The only file uploaded to the server is what the user commits to. That approach solves the problem that you are running into; however, it introduces the new problem of requiring Java to be installed on the local machine and integrated with the web browser.
you can create a small executable to delete files on* that temporary folder, and attach it to a schedule task so it will clean your temp. folder once in a while. But I don't know if you're hosting on a dedicated server or shared hosting because with shared hosting, this doesn't work
and is able to see a preview of the image they are about to upload
...
When the submit button is clicked, the codebehind handles the OnClick event and loads the image from the file input element. It then stores it into a temporary folder on the web server and sets the image control's ImageUrl to point to it.
Imagine this conversation:
Jim: I don't know if I can afford to drive my car to work today.
Bob: Why don't you just drive to work? When you pay for it, you'll know if you can afford it or not!
Jim: Awesome!
You've just uploaded the file to show them the preview of the file they're about to upload...
While this will undoubtedly work fine if your users are uploading small images over fast connections, when someone tries to upload a 3 meg JPEG over a slow connection, and then wonders why their webpage locked up from selecting a file (they didn't even press submit remember, so you've effectively locked them up 'randomly'), you may wish to re-evaluate this as a solution.
To actually display the image before it gets uploaded, you will need to use some kind of flash or silverlight object (or perhaps a java applet) which can produce a thumbnail of the local file on the user's local disk, before it gets sent to the server. As ugly as this may sound, there literally is no way to do it without some client side plugin.

Resources