title: Upload a file in Classic ASP without another class completely custom
body: <p>Yes I am using Classic ASP, not by choice I am supporting a Legacy application. Objective: I need to have a form page that submits to another .asp page that will upload the file and store it on the server in a certain directory such as "/uploads". I'm not real familiar with asp or asp.net so I am very new to this. I've created a test prototype:</p>
  
  <p>Form page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
  &lt;title&gt;Test upload&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form action="process.asp" method="post" enctype="multipart/form-data"&gt;
       &lt;p&gt;Filename: &lt;input type="text" name="filename" size="50" /&gt;&lt;/p&gt;
       &lt;p&gt;&lt;input type="file" name="file" /&gt;&lt;input type="submit" value="Upload file" /&gt;&lt;/p&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Processing page:</p>
  
  <pre><code>&lt;%
  
  Set fs = Server.CreateObject("Scripting.FileSystemObject")
  
  Set tfolder = fs.GetSpecialFolder(2)
  tname = fs.GetTempName
  
  'Declare variables
  Dim fileSize
  Dim filename
  Dim file
  Dim fileType
  Dim p
  Dim newPath
  
  'Assign variables
  fileSize       = Request.TotalBytes
  fileName       = Request.form("filename")
  file           = request.form("file")
  fileType       = fs.GetExtensionName(file)
  fileOldPath    = tfolder
  newPath        = Server.MapPath("/uploads/")
  
  fs.MoveFile fileOrigPath, newPath
  
  
  set fs = nothing
  
  %&gt;
  </code></pre>
  
  <p>The problem is that everytime I try to upload or run the script I get this error:</p>
  
  <pre><code>Microsoft VBScript runtime error '800a0035'
  File not found
  /tbird/fileUpload/process.asp, line 25
  </code></pre>
  
  <p>Obviously I'm not mapping correctly to the file and I think the major reason I am getting stuck is that in the first parameter of the <code>MoveFile</code> method I am not mapping to the file correctly. Can anyone tell me how I should be referencing the file or if I am doing it wrong?</p>
  
  <p>Thanks in advance I would really appreciate the help I've searched all over and everything I find related to classic asp and uploading files are classes that you can purchase and I don't want to do that.</p>