3

I am working the OS update from x86 to x64 now.

Here is a .asp project that work fine on x86 but not fine on x64.

The problem is x64 can't get the form parameter after post.

tgtdir = mySmartUpload.Form("tgtdir").Values

tgtdir is empty!!!

Is IIS setting problem? or something else?

Please feel free to leave the answer or comment if you have any idea.

Some code that I write is...

In Main.asp

<HTML>
<HEAD>
  <TITLE></TITLE>
</HEAD>
<BODY topmargin=4  leftmargin=10 bgcolor=wheat>
  <FORM id=form01 name=form01 align=center enctype="multipart/form-data">
    <TABLE width=100% align=center>
      <TR>
      <TH>
        <FIELDSET>
          <TABLE>
            <TR>
              <TD colspan=2>
                <INPUT type=file id=file01 name=file01 style="WIDTH: 400 px" value="Preview">
            <TR>
          </TABLE>
        </FIELDSET>
      </TH></TR>
    </TABLE>    
    <INPUT type=hidden id=tgtdir name=tgtdir value="AAA">
  </FORM>
  <DIV>
    <IFRAME id=frameUpload name=frameUpload >
    </IFRAME>
  </DIV>
</BODY>
</HTML>

In fileupload.asp

<HTML>
<HEAD>
  <TITLE></TITLE>
</HEAD>
<BODY>
<% 
On Error Resume Next
    Dim mySmartUpload
    Dim intCount

    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

    mySmartUpload.CodePage = "utf-8"
    mySmartUpload.Upload

    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    tgtdir = mySmartUpload.Form("tgtdir").Values

    intCount = mySmartUpload.Save(tgtdir & "\") 
%>
</BODY>
</HTML>
user692942
  • 16,398
  • 7
  • 76
  • 175
鄭有維
  • 265
  • 1
  • 13
  • Are you using any upload component in fileupload.asp? Maybe you should [edit] and show code for that page too. – Flakes Aug 31 '17 at 07:24
  • Even I comment out the update component, Still can't get the parameter. – 鄭有維 Aug 31 '17 at 07:33
  • 1
    It's not clear what is happening as you haven't describe whether you get an error etc. Having said that, if you are using an Upload Component, the form *(which you haven't shown so can only assume)* is likely sending using [`multipart/form-data`](https://stackoverflow.com/a/4526286/692942), means `Request.BinaryRead()` will be used in `fileupload.asp`. Fun fact, once `Request.BinaryRead()` is called invalidates the `Request.Form` collection, which is why most Upload Components provide their own collection to store the form parameters. This would explain why `Request.Form` calls aren't working. – user692942 Sep 01 '17 at 05:51
  • But if this was the case would still expect an error, but you haven't said you if you even get one. Put simply, this isn't a great question, try an [edit] the question to provide a proper [mcve]. – user692942 Sep 01 '17 at 05:52
  • In main.asp, I don't use upload component. – 鄭有維 Sep 01 '17 at 06:04
  • 1
    So what is aspSmartUpload? [This page](https://coreysalzano.com/how-to/aspsmartupload-dll/) says "A 32-bit library to facilitate file uploads via ASP Classic and IIS." – Vanquished Wombat Sep 01 '17 at 09:54
  • My guess is @LankyMart is on the right track. Most file upload components require the form sent as multipart/form-data, which in turns requires the use of Request.BinaryRead(). Make sure you initialize the upload component before making a call to Request data from the form. – Josh Montgomery Sep 01 '17 at 15:10

1 Answers1

0

Now that you have provided some key information that was originally missing I might be able to help.

While what I said in the comments about Request.Form in conjunction with Request.BinaryRead() is correct, I don't think that's the issue (confusion from the original revision of the question).

In fact, I believe what @Vanquished Wombat said:

So what is aspSmartUpload? This page says "A 32-bit library to facilitate file uploads via ASP Classic and IIS."

is closer.

So I did a little digging (as I don't use aspSmartUpload myself) and it turns out that (according to the last reported scan of the site on Wayback Machine) sometime before Jan 2008:

The aspSmart line of products has been discontinued.

While there is nothing wrong with this in itself it did make me think they probably didn't release a 64-bit version of the component, so the issue is going to be trying to run a 32-Bit COM DLL in a 64-bit environment.

I've spoken about this many times but for a complete breakdown of what you need to get it working see Error ASP 0177: 8007007e Server.CreateObject fails for COM DLL.

What is weird, is you haven't posted an error. If the DLL wasn't correctly registered in the 32-bit sub-system or the IIS site wasn't running it's App Pool in 32-Bit mode I'd expect some kind of error.

My advice would be to go through the steps in that answer and check against your setup, there is even a COM DLL Checklist at the bottom for you to check against.

user692942
  • 16,398
  • 7
  • 76
  • 175
  • aspSmartUpload need two dll. When i put it in \\nposvrtw1t2\C$\Windows\SysWOW64 and re-regsvr32 them! it's ok – 鄭有維 Sep 04 '17 at 04:00
  • Good to know, so the IIS app pool was already running in 32-bit mode. Also, there is no need to move DLLs into the SysWOW64 directory. My preferred method is to navigate to the folder where the files exist then call regsvr32.exe explicitly, in your example it would be `C:\Windows\SysWOW64\regsvr32 dllfilename.dll` from the aspSmartUpload directory. Moving the DLLs into the system folder also works but it isn't necessary. – user692942 Sep 04 '17 at 06:27