Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Why can't I access my form elements when using Pure ASP upload?

    Is there no way I can access the other form elements when i'm uploading using pure asp?
    I keep on getting this error everytime I attempt to access a form element.
    Cannot access form element after doing binary read... or something to that effect
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Here is a pure ASP (i.e. no components) resource for letting the user upload a file which is something that was unfortunately not built into ASP. And this does allow for accessing regular form fields. But as with any solution the syntax is a little different than a regular form with no file uploading:

    ASP File Upload Using VBScript by John R. Lewis - 7/10/2000
    http://aspzone.com/articles/160.aspx

    "But what if an HTML form without the proper ENCTYPE posted to our upload code? We have no way of determining this prior to calling Request.BinaryRead. Once we do this, we can no longer access the Request.Form collection. We need to be able to handle application/x-www-form-urlencoded as well.

    Lets examine this further..."
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #3
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    PLEASE tell me there's an easier way?
    That looks awfully confusing, not to mention tedious and impossible.
    And the legibility's discouraging
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Which pure ASP Upload script are you using? I'm sure the author included a property to get the form data which is the counterpart of Request.Form. The property is probably named Form.

    Code:
    uploaderObject.Form("nameOfFormElement")
    Check the documentation or demo of the script to see the available methods and properties of the uploader object.

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    And the legibility's discouraging
    True but the free code has worked well for me and you can copy and paste the code sample which is white on gray (what were they thinking?) or just highlight it and it becomes black on white.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #6
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    Which pure ASP Upload script are you using? I'm sure the author included a property to get the form data which is the counterpart of Request.Form. The property is probably named Form.

    Code:
    uploaderObject.Form("nameOfFormElement")
    Check the documentation or demo of the script to see the available methods and properties of the uploader object.
    I'm using the script over at
    Jacob Gilley
    Didn't see anything about accessing other form elements
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #7
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    OK with Jacob Gilley's code here's a code snippet in uploadexample.asp that shows examples about handling non-file fields such as fullname and saveto:

    '******************************************
    ' Use [FileUploader object].Form to access
    ' additional form variables submitted with
    ' the file upload(s). (used below)
    '******************************************
    Response.Write "<b>Thank you for your upload " & Uploader.Form("fullname") & "</b><br>"

    ' Check if any files were uploaded
    If Uploader.Files.Count = 0 Then
    Response.Write "File(s) not uploaded."
    Else
    ' Loop through the uploaded files
    For Each File In Uploader.Files.Items

    ' Check where the user wants to save the file
    If Uploader.Form("saveto") = "disk" Then
    Last edited by Bullschmidt; 08-22-2005 at 05:51 AM.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #8
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Bullschmidt
    True but the free code has worked well for me and you can copy and paste the code sample which is white on gray (what were they thinking?) or just highlight it and it becomes black on white.
    It looks very confusing and I'm really not a pro where asp is concerned.. If I just have to throw in the inputs to a particular function i'll give it a shot but not if I have to do intense analysis.... I'm in the middle of workin on a project
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #9
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Bullschmidt
    OK with Jacob Gilley's code here's a code snippet in uploadexample.asp that mentions something about handling non-file fields:

    '******************************************
    ' Use [FileUploader object].Form to access
    ' additional form variables submitted with
    ' the file upload(s). (used below)
    '******************************************
    Response.Write "<b>Thank you for your upload " & Uploader.Form("fullname") & "</b><br>"

    ' Check if any files were uploaded
    If Uploader.Files.Count = 0 Then
    Response.Write "File(s) not uploaded."
    Else
    ' Loop through the uploaded files
    For Each File In Uploader.Files.Items

    ' Check where the user wants to save the file
    If Uploader.Form("saveto") = "disk" Then
    My deepest gratitude... I forgot to check back the examples
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #10
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    You're welcome and hope you get it to work well in your project. And of course don't forget to give any needed permissions to folders you'll be uploading files to.

    And can increase the timeout for the particular page as you see fit:
    ' Script timeout in seconds for this page.
    ' (60 x 60 = 1 hour.)
    Server.ScriptTimeout = 60 * 60
    Last edited by Bullschmidt; 08-22-2005 at 05:55 AM.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

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