IT Community - Software Programming, Web Development and Technical Support

how to access local file from server?

This is a discussion on how to access local file from server? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Can we able to access the local file to JavaScript or VB Script? If no then how the browser write ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 09-27-2007, 06:53 AM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Thumbs up how to access local file from server?

Can we able to access the local file to JavaScript or VB Script? If no then how the browser write the cookie value in client side?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 10-04-2007, 12:30 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: how to access local file from server?

hi,
it is possible when the server is your local machine. i think using javascript we can't do any file handling. The cookies are maintained by the browser.
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 10-06-2007, 09:21 AM
tecquilla tecquilla is offline
D-Web Trainee
 
Join Date: Oct 2007
Posts: 3
tecquilla is on a distinguished road
Default Re: how to access local file from server?

Hi, you can do that with using ActiveX to access local file. By using Script.FileSystemObject

but almost all browser IE doesn't activate the ActiveX, so you must turn it on in your browser.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 10-08-2007, 06:55 AM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Thumbs up Re: how to access local file from server?

Hi tecquilla,
I enable the activex in IE like below
1. In Internet Explorer > Tools > Internet Options > Security > Custom Level
2. Enabling or prompting "Initializing and Script Activex controls not marked as safe"
Code:
function WriteToFile() {
try
{
var fso, s;
alert(1)
fso = new ActiveXObject("Scripting.FileSystemObject");
alert(2)
s = fso.CreateFolder("C:\\test.txt", true);
alert(3)
s.writeline("This is a test");
alert(4)
s.Close();
alert(5)
}
catch(err)
{
alert(err)
var strErr = 'Error:';
strErr += '\nNumber:' + err.number;
strErr += '\nDescription:' + err.description;
document.write(strErr);
}
}
WriteToFile();

But when i execute this scipt it throws the error "Error: Number:-2146827838 Description:Wrong number of arguments or invalid property assignment"

How to solve this?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 10-17-2007, 06:08 AM
vims vims is offline
D-Web Programmer
 
Join Date: Oct 2007
Posts: 67
vims is on a distinguished road
Default Re: how to access local file from server?

Quote:
Originally Posted by varghese View Post
Hi tecquilla,
I enable the activex in IE like below
1. In Internet Explorer > Tools > Internet Options > Security > Custom Level
2. Enabling or prompting "Initializing and Script Activex controls not marked as safe"
Code:
function WriteToFile() {
try
{
var fso, s;
alert(1)
fso = new ActiveXObject("Scripting.FileSystemObject");
alert(2)
s = fso.CreateFolder("C:\\test.txt", true);
alert(3)
s.writeline("This is a test");
alert(4)
s.Close();
alert(5)
}
catch(err)
{
alert(err)
var strErr = 'Error:';
strErr += '\nNumber:' + err.number;
strErr += '\nDescription:' + err.description;
document.write(strErr);
}
}
WriteToFile();

But when i execute this scipt it throws the error "Error: Number:-2146827838 Description:Wrong number of arguments or invalid property assignment"

How to solve this?
Instead of fso.createfolder we have to use fso.CreateTextFile

That is
s = fso.CreateTextFile("c:\\test.txt", true);

It will work
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 10-17-2007, 11:15 PM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Default Re: how to access local file from server?

Thanks Vims,
Its working fine in IE But not in firefox. Do you have any idea?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing local file system in Flash Karpagarajan Flash Actionscript Programming 2 08-05-2008 02:45 AM
Access To Local Disk seesamjagan Flash Actionscript Programming 1 02-24-2008 08:34 PM
Pass the client's local time to a server side process itbarota HTML, CSS and Javascript Coding Techniques 1 02-20-2008 08:51 PM
Importing mysql dump file to my Local Server Murali Database Support 1 12-12-2007 06:10 AM
Difference between a file and Random access file Classes anbuchezhians Java Programming 1 08-08-2007 01:53 AM


All times are GMT -7. The time now is 05:06 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0