473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XMLHttpRequest / JavaScript to download files from server to local

2
I am looking for an isolated piece of code that uses XmlHttpRequest/JavaScript to download files from a (specified path on a) server to local machine. The browser on the local machine (Mozilla/FireFox) does not require user interaction.
Oct 18 '08 #1
4 15445
Atli
5,058 Expert 4TB
So you want your browser to download files and save them to the hard drive on your clients computer? And to top that, you want to do this without the user even being aware of it?

If so, then no mate. Never going to happen.

Could you imagine what would happen if web-developers could simply save stuff on your computer without you agreeing to it or even being aware of it? No computer connected to the internet would survive for more than a day.

No browser will ever give your client-side scripts access to the file-system.
Oct 18 '08 #2
robain
2
So you want your browser to download files and save them to the hard drive on your clients computer? And to top that, you want to do this without the user even being aware of it?

If so, then no mate. Never going to happen.

Could you imagine what would happen if web-developers could simply save stuff on your computer without you agreeing to it or even being aware of it? No computer connected to the internet would survive for more than a day.

No browser will ever give your client-side scripts access to the file-system.
No, the device with the browser is not a client or customer machine, but a dedicated device to reproduce multimedia content. Basically it´s a media player. It is programmed not to require user interaction, as the only controller of the dedicated device is also the controller of the server. Can you not work with server sockets on both sides, so that the server always accepts requests from player and vice versa. The only thing missing then is still the code on how to do this (download file from server to player via HTTP).

Here goes some comment from the device/software manufacturer:

+++
There is a way to do that [..initiate download from player]. That way is a standard way for Mozilla (or Firefox) based browsers.

You can use TCP sockets in your JavaScript applications like you usually do in C or any other general purpose language. See http://www.xulplanet.com/tutorials/mozsdk/sockets.php

You even can use server sockets in JavaScript. See http://www.xulplanet.com/tutorials/m...serverpush.php

You also can access local file system. See http://developer.mozilla.org/en/Code.../File_I%2f%2fO

You can also take a look at Mozilla jslib http://jslib.mozdev.org/

All this code requires interaction with user to ask him if he allows to perform the operation. In our player-browser [Mozilla/Firefox] this interaction is not required.

All these operations are allowed by default.
+++
The thing is I am just not a programming expert, and want only to have the right code to execute this operation.

Thanks a lot.
Oct 18 '08 #3
rnd me
427 Expert 256MB
you can use flash for sockets.

you can load remote files into variables, but you cannot save them on the local machine.

although in firefox and IE8, you can store up to 5mb of data using window.globalStorage.

you can store 10mb w/o permission by tunneling into flash.
Oct 20 '08 #4
akarsh
3
I don't know that which server side technology you are using. But if u are trying it in PHP then at first you have to make a request to your server using XMLHttpRequest object and on the server end you have to read that file's content using readfile() function. Then you should set some headers like content-type, pragma and Cache-control etc and finally echo that content on your web page using PHP 'echo' .
Oct 22 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: scrimp | last post by:
Ive been using PAMIE 1.4 to try to automate web page processes. The one thing I cannot do with it is upload files and download files. With uploading files, the file input box does not allow PAMIE...
0
by: Sachit | last post by:
I am working on an BIT application to download files from remote server using C#, There are an issue related with performance, I am downloading 3 files 28Kb, 79KB, 121KB respectivly on my...
1
by: Matt Hamilton | last post by:
I was hoping that someone can give me step-by-step instructions to fix the following: We would like our ASP.NET application to utilize a central file server for uploads and downloads. I have...
2
by: Grant | last post by:
Hi, I'm trying to download files using asp.net (vb) and it seems to take forever to actually bring up the Save As dialog box. The files are Academic Software Downloads so are quite large in...
6
by: Michael Tissington | last post by:
I have setup up Forms Authentication on my website and added configuration/mappings for exe, pdf and zip files (using C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll) However when...
0
by: tanyali | last post by:
using php5, I download files : ******** downloadfile.php $fileContent = @mysql_result($result1,$i,"gdata"); ...
12
nathj
by: nathj | last post by:
Hi, I am working on a system, as you may have seen from my other posts, that allows members to download files. When they download a file I want to store the user ID and the file ID in a table...
1
by: samvb | last post by:
hi guys, i am lookin to creatin a local site. i want them to download files to thier local computer from the server. how can i do that? the server is ftp.
1
by: kishoreforqns | last post by:
how to download files (2mb>) using networkstream from a mailserver.. i can conenct to the mail server, list unread mails, and i can also retreive unread mails. but that till 1.5 mb. how to do...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.