SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist hessodreamy's Avatar
    Join Date
    Apr 2005
    Location
    uk
    Posts
    524
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Silently upload file using hta (hypertext application)

    I've got a pc which will hold some log files, and I want to get them onto my server.

    Rather than use a combination of batch scripts, ftp, and cron jobs, I thought I'd try using an hta htpertext application on the local machine, to upload the log file.

    So I'm trying to do a hta file that will upload a specified file via a self-submitting (javascript), then close itself, but I'm having 2 problems:

    1. Specifying the file name as the value of the file in the form doesn't seem to have any effect. The form comes trhough with a blank field.
    2. On submitting the form to the server, it opens an IE window to view the returned page (even if it's blank). If I ran the script every 10 minutes or whatever, the screen and memory would soo get full.

    I know there aren't a lot of people using hta files, but any ideas?

    Here' s the code I'm using:
    Code:
    <form enctype="multipart/form-data" 
    
    action="http://myserver/form.php" 
    
    method="POST" name="form1">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    <input name="uploadedfile" type="file" value="test_upload.txt"/>
    <input type="submit" value="Upload File" />
    </form>
    
    <script>
    
    document.forms.form1.submit();
    window.close();
    </script>

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    I'm not sure about the .hta you're using, but as far as I know, you can't set the value of file inputs using javascript or the value attribute.

  3. #3
    SitePoint Evangelist hessodreamy's Avatar
    Join Date
    Apr 2005
    Location
    uk
    Posts
    524
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ah, well if that's the case then I might as well abandon that route and go back to plan A. Thanks for the clarification. I must say I've never tried to set the value of file inputs using javascript.


Bookmarks

Posting Permissions

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