Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2003, 07:04 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default Uploading Files

Hi,
I am creating a form which should upload a file to the server but the code gets stuck at a certain point.
The code from the form is:

<form method=post enctype="multipart/form-data" action="CompanyFolderTab.asp" target="filelist">
    <tr>
        <td class=header bordercolor="#315182" colspan=2>
            Nieuw of aangepast bestand publiceren
        </td>
    </tr>
    <tr>
        <td>Bestand&nbsp</td>
        <td><input type="file" name="fileSource"></td>
    </tr>
    <tr>
        <td width=1></td>
        <td><input type="submit" value="Publiceren"></td>
    </tr>
    </form>

In the CompanyFolderTab.asp the Upload.inc is included and the function GetFields is called

This function looks like this (The logfile exists and works)

Function GetFields(UploadSizeLimit,logfile)
  logfile.WriteLine(" Function GetFields. UploadSizeLimit= " & UploadSizeLimit)
  Dim Result
  Set Result = Nothing
  'Request method must be "POST"
  If Request.ServerVariables("REQUEST_METHOD") <> "POST" Then
    logfile.WriteLine("Request method is " & Request.ServerVariables("REQUEST_METHOD") & ".")
    Err.Raise 51, "GetUpload", "Request method is """ & Request.ServerVariables("REQUEST_METHOD") & """. Dit moet ""post"" zijn."
  Else

    'read Content-Type
    Dim CT
    CT = Request.ServerVariables("HTTP_Content_Type")
    logfile.WriteLine("Header = " & CT)
    ' Content-Type header must be "multipart/form-data"
    If LCase(Left(CT, 19)) <> "multipart/form-data" Then
      logfile.WriteLine("Header is niet multipart/form-data maar is :" & CT)
      Err.Raise 51, "GetUpload", "Content-type is """ & CT & """. Dit moet ""multipart/form-data"" zijn."
    Else
      Dim Boundary, PosB, PosE

      'Get the boundary and length from Content-Type header
      PosB = InStr(LCase(CT), "boundary=")
      If PosB > 0 Then Boundary = Mid(CT, PosB + 9)

      '****** Error of IE5.01 - doubles http header
      PosB = InStr(LCase(CT), "boundary=")
      If PosB > 0 then 'Patch for the IE error
        PosB = InStr(Boundary, ",")
        If PosB > 0 Then Boundary = Left(Boundary, PosB - 1)
      end if
      logfile.WriteLine("PosB : " & PosB & " Boundary : " & Boundary)
      '****** Error of IE5.01 - doubles http header

      Dim Length
      Length = CLng(Request.ServerVariables("HTTP_Content_Length" )) 'Get Content-Length header
      logfile.WriteLine("Length = " & Length)
      If "" & UploadSizeLimit <> "" Then
        UploadSizeLimit = CLng(UploadSizeLimit)
        If Length > UploadSizeLimit Then
' Request.BinaryRead (Length)
            logfile.WriteLine("Uploadsize is to large.")
          Err.Raise 2, "GetUpload", "Upload (" & FormatNumber(Length, 0) & " B) is groter dan toegelaten (" & FormatNumber(UploadSizeLimit, 0) & " B)"
          Exit Function
        End If
      End If

      If Length > 0 And Boundary <> "" Then 'Are there required informations about upload ?
        Boundary = "--" & Boundary
        logfile.WriteLine("Length = " & Length & " - - Boundary : " & Boundary)
        logfile.WriteLine("Why do you stop here?")
        Dim fileData
        fileData = "dude this is going bad"
        logfile.WriteLine("Dim Binary : " & fileData )
        'Reads binary data from client
         fileData = Request.BinaryRead(Length) ///////This is were it goes wrong
         logfile.WriteLine("After binary read")

        'Retrieves the upload fields from binary data
        Set Result = SeparateFields(fileData, Boundary)
        logfile.WriteLine("Result = " & Result)
        fileData = Empty 'Clear variables
      Else
      logfile.WriteLine("Http contents is empty")
        Err.Raise 51, "GetUpload", "HTTP inhoud is leeg."
      End If
    End If
  End If
  Set GetFields = Result
End Function


I know it is a lot of code but near the end there is the line:
fileData = Request.BinaryRead(Length)
This is were it goes wrong. The script will not go past this line.
(Length = TotalBytes)

any suggestions to how I can get this to work.

Greetz

Tom.
 
Old August 22nd, 2003, 07:45 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

By the way:

The Error message is


Request object error 'ASP 0104 : 80004005'

Operation not Allowed

/includes/Upload.inc, line 74

and line 74 is fileData = Request.BinaryRead(Length)

Greetz

Tom
 
Old August 22nd, 2003, 10:22 AM
uit uit is offline
Authorized User
 
Join Date: Jul 2003
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Watch that you dont have anti-virus software on that IIS server which prevents script processing - that will hold it up.
 
Old August 25th, 2003, 03:11 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have found that the error doesn't occur with small files.

< 100 K

But once a file is a bit larger but still within the limits I set I get the error.

How does this come and how do I solve this.

To Recap: the upload works but not with larger files.

Any suggestions.

Greetz

Tom.
 
Old August 25th, 2003, 03:26 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, my day is saved thanks to the following post I found on another forum.

For all the persons who have trouble with up and download in asp with iis 6.0 here is the solutions that helped me

IIS 6.0: upload and download issues
If any of you are having issues with uploads and downloads with Web Explorer Free and are running IIS 6.0, try these solutions first: open up the file "metabase.xml" with notepad...should be located in C:\windows\sytem32\inetserv. Find the variable named "AspBufferingLimit" and change it to something greater than what is there. By default this is set to around 4 megs. By changing this variable you are increasing the max size of ASP response buffer, thus letting you download files greater than 4 megs using WexFree. For uploading files greater than this ammount, look for the variable named "AspMaxRequestEntityAllowed" and change it to the desired size. And there you have it. By increasing the number of these variables, you can controll the size of uploads and downloads (respectively) while using Web Explorer Free. Hope this helps. -Peace-


Enjoy

Greetz

Tom.
 
Old October 26th, 2003, 11:49 PM
Registered User
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i can not get metabase.xml to save when editing in notepad...

how did u manage to edit it?

 
Old October 27th, 2003, 12:21 AM
Registered User
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by tbriers
 Well, my day is saved thanks to the following post I found on another forum.

For all the persons who have trouble with up and download in asp with iis 6.0 here is the solutions that helped me

IIS 6.0: upload and download issues
If any of you are having issues with uploads and downloads with Web Explorer Free and are running IIS 6.0, try these solutions first: open up the file "metabase.xml" with notepad...should be located in C:\windows\sytem32\inetserv. Find the variable named "AspBufferingLimit" and change it to something greater than what is there. By default this is set to around 4 megs. By changing this variable you are increasing the max size of ASP response buffer, thus letting you download files greater than 4 megs using WexFree. For uploading files greater than this ammount, look for the variable named "AspMaxRequestEntityAllowed" and change it to the desired size. And there you have it. By increasing the number of these variables, you can controll the size of uploads and downloads (respectively) while using Web Explorer Free. Hope this helps. -Peace-


Enjoy

Greetz

Tom.
I tried this... unfortunately didnt help for the download via ado.stream..

the save to dialogue doesnt even pop up when i changed the 4MB limit to a 40MB limit.



 
Old October 27th, 2003, 04:55 PM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The Save Dialogue box doesn't have anything to do with the limits set in the xml file.

When this does not show there is probably something wrong with your Form Code.

The Errors that have something to do with the upload limits occur on the server side and a dialogue box happens on the client side.

Regards, Tom.





Similar Threads
Thread Thread Starter Forum Replies Last Post
uploading files vinoskiboyetski Beginning PHP 1 November 28th, 2007 02:30 PM
uploading files rj1406 ASP.NET 1.0 and 1.1 Basics 1 October 11th, 2004 10:27 AM
Uploading Files sami PHP How-To 7 April 16th, 2004 02:29 PM
Uploading files mildge Beginning PHP 6 December 1st, 2003 12:42 PM
uploading files by c# rborsatti C# 2 September 29th, 2003 03:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.