www.webdeveloper.com
Results 1 to 3 of 3

Thread: Automatic file upload

  1. #1
    Join Date
    Mar 2014
    Location
    Corpus Christi, TX
    Posts
    88

    Automatic file upload

    All,

    I am trying to write a script that will be launched automatically in a browser to upload a particular file on to my server. I have written code in the past that allows someone to select a file, but I want this particular file path to be predetermined and then automatically upload.

    The file path will be "C:/CSVUload/**VARIABLECOMPUTERNAME***.csv

    Each file name will have the COMPUTER NAME as the filename, and the CSV file will be the ONLY FILE in the folder.

    Totally automated. No user interface whatsoever.

    What's the best way to go about this?

  2. #2
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    899
    I'm afraid this isn't going to work the way you seem to want it to. From the looks of this you are trying to automatically upload a file from a computer to your server through web languages. I can already tell you that it's impossible via any front-end language (none of these have access to a computer).

    It could technically be done via PHP (or some other server-side language) but in that case PHP (and a server) would need to be running on any PC that will need to upload the file.

    I know you mentioned past code that allowed a user to select a file and then have it uploaded. That is perfectly fine since it requires the user specify a file. The file <input> type is very, very restricted when it comes to scripting. Basically when a user selects a file the browser handles all of the details and passes the file to the server (on form submit). Javascript nor PHP is able to read the actual file path or alter the value in that field.


    So in short, what you seem to want will require something other than what standard web languages offer.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  3. #3
    Join Date
    Mar 2014
    Location
    Corpus Christi, TX
    Posts
    88
    I found a solution using VBS. Was able to load the site, select the file, and upload. We'll see how successful this is when it goes live to all our computers.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles