473,785 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemObjec t - reading a picture file

3 New Member
hi,

i am trying to use the fileSystemObjec t methods to read a picture file as a text (forcefully), store it in a variable, and then i try writing it back to a file and opening it up with a text editor. I just don't get why they get corrupted:

var ForReading = 1;
var TriStateUni = -2;
var fso = new ActiveXObject(" Scripting.FileS ystemObject");
var newFile = fso.OpenTextFil e(localPath, ForReading, false, TriStateUni);
var tempText = newFile.readAll ();
newFile.close() ;
var qqq = fso.CreateTextF ile ("C:\\xxxxxxxxx 22.txt", true);
qqq.Write (tempText );
qqq.Close();

what i get in the xxxxxxxxxx22.tx t file is exactly the head and tail portions of the original .jpg file. and a whole chunk of blanks/empty spaces in the middle.

when i do a tempText.length , the length is the same as the amount of characters in the original .jpg file.

* * *

other than this, is there any other better method in Javascript that i can use to open up any files (not just jpg) as text, ie, like using notepad to do so? and hopefully, cross browser?

i'm doing a project and the aim of having any file in a var is to do encryption on it..

thank you to anybody who can help me....
Jun 29 '06 #1
1 4137
scienceguy
1 New Member
For security, file reading and writing is not a common feature of browsers, i believe only IE has it, and that still has security limitationes, like only letting the script run if the client says so. And the only way to read/write files is using the FileSystemObjec t.
Nov 12 '06 #2

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

Similar topics

7
7100
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and disadvantages of using a MySQL blob field rather than reading the images directly from the file? How does one insert an image into a blob field? Can it be done dynamically? Thank you John
5
4065
by: John Dewbert | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** Hello, I have trouble passing a folder object (from a FileSystemObject) to a sub procedure. Consider the following code: =================================
3
2122
by: Steve | last post by:
Hi all, FileSystemObject question... I'm trying to check if files exist or not, but the files are not sitting on the same server as our Intranet. Basically we have about 5000 photos in a directory on our database server, and they must stay there. I want to use the FileSystemObject (running on our Intranet server) to check if a photo is there, if so display it, if not
3
3448
by: bt | last post by:
I am just beginning with asp and have gotten an error that I need some help with. I posted a pair of files to an online ASP host server. The files are in the same directory; one is readfile.asp which should open the other which is a simple text file - newText.txt . Here is readfile.asp : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html>
2
7736
by: Wendy Powley | last post by:
I am using a FileSystemObject to open a text file and the ReadLine method to read the file line by line. Set fs = CreateObject("Scripting.FileSystemObject") Set ReptFile = fs.OpenTextFile(file, 1, 0) Reptln = ReptFile.ReadLine
6
2239
by: Singularity.co.uk | last post by:
Hi Does anyone know of another way to check if a file exists without using the FileSystemObject? Brendan
0
1319
by: Pedro Bautista | last post by:
Status: Unsolved and puzzling Steps to reproduce the error: 1.- Delete IUSER from server 2.- Reboot server (OS rebuilds IUSR) 3.- Assign IUSR read and execute permission on web folder and enable propagation of inheritable permission on child folders. 4.- Read a file using Server.FileSystemObject into the web
9
3927
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object', 'Scripting', 'Scripting.FileSystemObject', and a few others However, when I try to create the fso object I keep receiving an error. 'ActiveX component can't create object: 'Scripting.FileSystemObject'
3
5912
by: brigitte | last post by:
The original problem: I need a procedure to import a csv file created by a third party application into an Access database. This file contains fields which may include commas, and when they do, Access confuses the commas for field separators, so that a block of text which should all be in one field ends up in two fields. I've seen by reading through this group that this is a pretty common problem with csv files. The solution I came up...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.