Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

create file on web server

  • 25-04-2003 4:27pm
    #1
    Closed Accounts Posts: 10


    I want to create a file on an iis webserver using javascript. am i correct in stating the filesystemobject will only work on the local filesystem (PC). what do i need to use to create on the web?


Comments

  • Registered Users, Registered Users 2 Posts: 2,120 ✭✭✭p


    You'll need to use some kind of server side porgamming.

    Common technques are PHP, CGI & ASP.

    Now off to google with you. (:

    - Kevin


  • Closed Accounts Posts: 10 Dell Boy


    Server side programming, really. I never would have thought of that.

    Still waiting for some useful advice.......


  • Registered Users, Registered Users 2 Posts: 2,120 ✭✭✭p


    Well when you ask can you do it with javascript and don't actually grasp the english language you come quite clueless.

    Ask intelligent questions and get intelligent answers.

    You ungrateful git...


  • Closed Accounts Posts: 1,651 ✭✭✭Enygma


    p actually gave you some useful advice, why not follow it.

    Off to google with you.


  • Moderators, Politics Moderators Posts: 41,217 Mod ✭✭✭✭Seth Brundle


    have a look at aspin.com or search google


  • Advertisement
  • Closed Accounts Posts: 237 ✭✭FreeHost


    There are two questions with FileSystemObject

    1. Do you want to use it in a web application
    2. Do you want to use it on a web page

    If you want to use it on a web page, it will work OK, but your going to run into problems.

    First, anybody who visits that page will get a warning message, telling them it's insecure, they must answer "Yes" or "No"

    Secondly, if they say "yes" there anti-virus software will start giving them warnings.

    I have attached a file with a bit of code I grabbed from the microsoft site. Save the file to your local system and rename it test.html, then run it in your browser and you'll see what I'm talking about.

    If your using it in a web application, well that's a different story. What do you want it to interrogate or write


  • Closed Accounts Posts: 10 Dell Boy


    P: as regards grasping the english language, let me state that english isn't my first language. Also your own grasp of the english language doesn't seem to be that firm <QUOTE> you come quite clueless </QUOTE>

    I thought the question clear enough, as did FreeHost, who actually provided some useful advice. Many thanks.

    FreeHost, I cannot see that attachment. However I now have my code running on the webserver and I get no security / a.v. errors. Could you post it again, so I can see if i need to check security settings?


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Sorry boys and girls, but Dell Boy's right and you're wrong. Javascript is most commonly used as a client-side scripting language, but it can also be used for server-side programming if necessary. Has been for years in fact.

    Off to Google with you, smartarses. :)

    adam


  • Closed Accounts Posts: 237 ✭✭FreeHost


    Yes I see it didn't attach,I cant seem to attach so copy and past this

    ************************************************

    <%@LANGUAGE=&quot;JAVASCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <script language="JavaScript" type="text/JavaScript">
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var a = fso.CreateTextFile("c:\\testfile.txt", true);
    a.WriteLine("This is a test.");
    a.Close();
    </script>
    </body>
    </html>

    **************************************************


  • Closed Accounts Posts: 10 Dell Boy


    Freehost,
    I can see where you might get security errors, you may not have privilege to write to the root of the c drive. I used server.mappath() in the createtextfile call which pulls up the full physical path to my virtual directory (if that makes sense) and it seems to work fine and creates a file in a subdirectory of the site.
    Thanks anyway.

    I wonder who or what runs the javascript. Is it the IISUSR with limited privileges, a system account with full RWX or what? I'm a bit unclear about client side / server side and what runs where

    If i try to create a file in c:\\ i just get an error. my hosting provider obviously doesn't allow such carry on, but I can create files fine in my own virtual folders.


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    There are two components to uploading from a browser to a server. First of all we have our server-side component, which is in essence a HTML form which will send the necessary data using HTTP post, encoded so that the server will know that it’s going to receive multiple items in the form data and to the script that will of course handle it (which I’ve called ‘foobar’ below):
    <form method="POST" enctype="multipart/form-data" action="foobar">
    
    Attaching files to a HTML form is done using an input tag with with the type attribute set to “file”.

    Receiving the file at the server varies somewhat from platform to platform and from to language to language but it all works on the same principle of reading the data and either writing it to a directory on the server using the FileSystem Object, or directly to a database (typically as a blob data type).

    I recommend Googling at this stage for further details, as I’ve no intension of explaining how exactly it’s done in every language (or the ones I know).

    A final note is to remember when reading/writing data using the Win32 FileSystem Object, that it treats binary and text data differently. In the case of *nix, this is not an issue.

    HTH


  • Closed Accounts Posts: 237 ✭✭FreeHost


    Dell Boy
    Unlike some other languages, JavaScript is compiled on the local machine, there is a built in engine called Microsoft Virtual Machine in Internet Explorer, which creates the runtime environment for JavaScript to work on a local machine.

    I have come across many examples of this where people in a company cannot see certain elements on a web page, the network manager probably done a bare minimum browser install, and left VM out. When they download and install VM it works perfectly.

    If you want Java to run server side, your provider would need to install something like Tomcat. When you FTP into your account does it have a directory called “WEB-INF” if you have, then Tomcat is running on that server. Here you can compile your java files into .class files and call them with JSP pages.


Advertisement