Classic ASP get textbox value – using VBScript

asp-classicvbscript

I am trying to upload a file to my server. The file is uploading but I would like to get the value that is in the File1 textbox. I do NOT want the path, I want just the filename that I'm saving.

<html>
    <head>
     <title>File Upload</title>
    </head>
<body>
    <form name="uploadr" method="post" action="" enctype="multipart/form-data">
        File 1 : <input name="File1" type="file"/><br/><br/>
                 <input name="btnSubmit" type="submit" value="Upload files &gt;&gt;" /><br/>
                 <input name="hiddenVal" type="hidden" value="testVal" />
    </form>
</body>
</html>

I have the following VBScript:

<% 
    Server.ScriptTimeout = 2000
    Form.SizeLimit = &H100000

    If Form.State = 0 Then 'Completed
        Form.Files.Save DestinationPath 
        response.write "<br><Font Color=green>File  (" & Form.TotalBytes \1024 & "kB) was saved to " & DestinationPath & " folder.</Font>"
        response.write(document.uploadr.hiddenVal.value())
    ElseIf Form.State > 10 then
      Const fsSizeLimit = &HD
      Select case Form.State
            case fsSizeLimit: response.write  "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
            case else response.write "<br><Font Color=red>Some form error.</Font><br>"
      end Select
    End If'Form.State = 0 then

%> 

When it gets to the response.write(document.uploadr.hiddenVal.value()) it says 'Document' variable undefined.

What do I need to do to get the value of the textbox?

Best Answer

Try this:

response.write(UploadFormRequest("hiddenVal"))

Related Topic