File Stream Object
I am trying to create a text file by using the following code. But it's not working. It just loading the page that's all.
<%
DIM fso, NewsFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set NewsFile = fso.CreateTextFile("c: est1.txt", True)
NewsFile.WriteLine("Hello World!")
NewsFile.Close
%>
View Replies
ADVERTISEMENT
I'm trying to create a page that uploads a file. I get an error message saying ADODB object Stream is not available in my server. How do I upgrade my ADODB library?.
View Replies
View Related
I have an ASP page that downloads file with the ADODB.Stream object.
I've found that if the user click cancel in the "Save file as" window or
during the downloading, the download is no more available, the page hangs
over and and the session have to be closed. (In some cases you have to Cancel
more than one time the download process to rise up this error).
I've experienced this problem, as a user, with many major webmail services
too!
View Replies
View Related
i want to be able to write an asp.net function to download files.
For example, brinkster.com hosting service has a COM component that allows a stream of binary data to the client from the server so that the client will be prompted to download the file.
here is the syntax:
Set Upload = Server.CreateObject("Persits.Upload")
Dim SysFilePath
SysFilePath = Request.QueryString("filePath")
' Parmeters:
' 1. Path to file to download
' 2. Yes, build content-xxx headers
' 3. Use this value for Content-Type header
' 4. Include the word "attachment;" to Content-Disposition to force download
Upload.SendBinary "premfs3sitespremium8jaydakissx22webrootmyFile.txt, True, "application/octet-binary", True
How can I do this in asp.net without using the "Persits.Upload" COM object?
View Replies
View Related
I have a page on our intranet that is supposed to stream an Excel sheet to the user.
View Replies
View Related
The following code was suggested by one of the users in this newsgroup when a pdf file was requested by a user from an asp page. I used the similar code in my page and the very interesting thing is when the pdf is displayed on the fly, the whole page is a gibberish code in stead of a normal pdf file. But it displays fine if I just use a link to a file on the page. Can you tell me what's the possible reason will cause this problem?
View Replies
View Related
I use the code below to authorise the download of certain files.
Thus, instead of linking to the file in a wwwroot directory, I link to
this code with the filename as a parameter, and the script streams the
file if the user is authorised.
This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB
file presents the error message 'format error: not a pdf or corrupt'.
Is there a file size limit, or a default that needs overridden? Any
thoughts? Code:
View Replies
View Related
I have code that loops through a directory reading files..
now the problem is that files are constantly being uploaded and I only want the file system object to read those that are finished being uploaded.
How can I check the properties of the file to see if it's in middle of being written before i read the file?
View Replies
View Related
I am using the File System Object to create server side cookies and part of
the Function that I am writing deletes a file but I am getting a permissions
denied error on that line of code.
I am using Integrated security only on this site but how do I get the
IUSER_Machinename account to work with Integrated Security?
View Replies
View Related
Im trying to do something very simple with the file object. I try to access it but when I open the page through the browser my server doesnt seem to respond...it just wont load the page, much like what happens in an infinite loop, the status bar slowly moving up forever. I would be very grateful for ANY suggestions you may have to the problem. Ive attached my code below,
SET objFSO = Server.CreateObject("Scripting.FileSystemObject" )
SET objFile = objFSO.GetFile(Server.MapPath("log.txt" ))
Response.Write("log.txt was last modified " & objFile.DateLastModified)
SET objFile = NOTHING
SET objFSO = NOTHING ...
View Replies
View Related
I am trying to create a text file by using the following code. But it's not working. It just loading the page that's all.
<%
DIM fso, NewsFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set NewsFile = fso.CreateTextFile("c: est1.txt", True)
NewsFile.WriteLine("Hello World!")
NewsFile.Close
%>
View Replies
View Related
How the heck would I go about saving an object to file? Put would be perfect, and can basically save everything except objects - how do I save an object if I can't use put?
View Replies
View Related
I have a server which has 100 template websites on it, each with unique domains. This may grow upwards to 500 websites. As I have been publishing websites to the server now and then I come across a bug in some code OR wish to enhance an aspect of the site. With the exception of a file or two, every site on the server has the same folder hierarchy.
Example, every site has a directory called toolbox. If I make a change in one file located in a particular site, can I write a script that some how woud copy that file and iterate through ALL sites inserting that file as necessary. I don't expect someone to show me how to do this, but rather tell me if it is a logical approach to managing such a large number of sites.
View Replies
View Related
Is there any command in FSO syntax to delete a record (delete a line) in a textfile database? Example:
WriteRecord.DeleteLine(Record)
View Replies
View Related
I have used File System object to write contents in a text file. But when i request the page, it just processing without completing the job.. The writing to text file is not happening.
View Replies
View Related
what im trying to do is write out certain files that our in a current folder. For example I have a folder called images and i have about 20 sub folders inside of the images folder. What i want to do is search the Images folder including all the subfolders and write the name and path of where ever the image was found inside of the images folder.
View Replies
View Related
I have about 200 documents to which I need to write a header and a footer. Appending (the footer) is easy, but I cannot figure out how to write to the very beginning of the file.
View Replies
View Related
when we use File system object in asp to read disk content of a server, in which sort order file system object reads and put all files in a list. well I put images in a folder and FSO reads and display on web page, I want to sort these images, for example by name or by date of creation.
How can I do that,If I have to do something with fso or, I can sepratly sort the listitem where fso stores the list.
View Replies
View Related
I have a web site that uses NT authentication. It accesses a file on another server using FSO. The user has full control of that file yet when trying to access it via the website they get a Access Denied error. Shouldn't IIS use the current security context (which has rights to file) to access the file?
View Replies
View Related
Given a folder with a hundred images can someone please show me how to loop through the files and rename them like this
auto1.jpg
auto2.jpg
auto3.jpg
etc
etc
View Replies
View Related
Can some tell me how can I search for a particular block of text within the file and delete it? Section of the file I want to change looks like the one below and I want all
the lines starting with dteHolidays[ deleted?
/* INSERT HOLIDAYS HERE!
*/
dteHolidays[0] = new Date("01/01/2004"); // CHRISTMAS DAY
dteHolidays[1] = new Date("04/09/2004"); // Good Friday
dteHolidays[2] = new Date("04/12/2004"); // Easter Monday
View Replies
View Related
I am building an upload script that overwrites any file with the same name, however the file could be a jpg, gif, bmp etc. Using 'fso.FileExists ' i can find if a file of the same name exists and remove it. The file will be saved as strMemberId.strFileExt. There is a possibility that file xyz.jpg may be re-uploaded as xyz.gif thus while the new image will be written to the folder the previous file will not be removed.
I am trying to find the best way of finding the file name of a file without the extension so I can delete any files that may exist with the same name but a have different extension. Is there a way of calling a wildcard in asp?
eg ' fso.FileExists(Server.MapPath("../tempfolder/" & strMemberId &".*" ))
' - tried this & several other combinations but it does not work.
The only other way I can see of doing it is to pass the file name into a string, strip the extension off it and then build an array to loop through the possible extensions but I am sure there is a better way.
View Replies
View Related
I have script which is to check if a folder is existed. Even though the folder (virtual directory) is existed but the script objFSO.FolderExists() always return false.
The script as following:
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("../images/thumb") Then
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
response.Write("Folder exists")
else
objFSO.CreateFolder(("../images/thumb")
response.Write("not existed")
end if
View Replies
View Related
whenever i am using the File System Object on IIS my ASP page tends to "hang", but doesn't report any errors.
View Replies
View Related
if it's possible to tell if a file is already open. If I have a file on the server that I just want to put log information to, and I don't want to have collisions obviously. Can I tell if the file is open already?
I would have the code loop until the file has been closed and then go ahead and do its thing. Alternatives are welcome. Databasing is an option, but I'd like to know anyway if the file can be "read" for open state.
View Replies
View Related
I have an include file - myUtilities.asp - containing 20-30 functions.
Would it waste less ressources if the functions were in an object instead?
There's about 20 pages including the file.
View Replies
View Related
I have recently built a web interface to handle files on my network at work. There has been another system in effect for quite some time, and we can't phase it out just yet. In this older system there is a lot of data pointing to files in a particular directory.
PHP Code:
// doesn't work. mypath=" heserversomedirectoryThat Has. a Decimal" // works mypath=" heserversomedirectoryThat doesnt have a Decimal" Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.Getfolder(mypath) Set fc = f.SubFolders
View Replies
View Related
I have an ASP Page that reads in the contents of a directory on the web server. My page hangs when it gets to 'MyFolder=set fso.GetFolder(FlrPath)'.
The FldrPath holds the correct path and fso has been set to
'Server.CreateObject("Scripting.FileSystemObject")'
what could be causing this?
View Replies
View Related
Does using the File system object multiple times across the page to check if relevant files exist use a lot of memory/server resource etc?
if this were the case, I was going to change this to check a DB field instead. ie when a file is uploaded then this is logged accordingle in the DB, then it can be this field used to check as to whether to display it or not - or are either equally.
View Replies
View Related
i am unable to create new folders using file system object. the createfolder method doesnt work....the progress bar becomes slow...and no folder is created....but the other methods such as folderexists work....i have also checked the permissions...all folders have read/write..
View Replies
View Related
Actually, I do not know why i can not add records to my access database table by using asp code, I get an error that tells me that the database file or object is read only file even though the file is not readable only from its proprties, I need some helpful information to solve this problem.
View Replies
View Related
Is there any way of rollback any changes made by the file system object in
the event of an error. I delete a file and copy one somewhere and the copy
fails is there anyway to rollback the delete. Essentially a file system
version of a transaction.
View Replies
View Related
I have created a function to remove file from the webserver, but it's not working of course...I am running IIS5.1 on WindowsXP. Here is a copy of my function Code:
View Replies
View Related