Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Filefield Postback woes

Filefield Postback woes

Scheduled Pinned Locked Moved ASP.NET
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vodstok
    wrote on last edited by
    #1

    I have recently created a form that gives the user the option of filling out certain information in either text fields, or as file attachments, or a combination of both. The problem i am runninginto, is that if the user clicks the browse button and selects a file, then hits any of the other controls that do a postback, the selected file is lost. I have tried using this.filefield.EnableViewState = true to see if that would keep, but it doesnt. i also have not been able to progromatically assign a value or a PostedFile.Filename. the page errors out and says that they are not "settable" (gotta love "msenglish") if i could grab the information and pass it to a hidden field, or allow the viewstate to hold it, that would be great. My only other recourse is to make it so that selecting files to upload is the LAST thing that can be done before submission, but that is a pain in and of itself, and doesnt do doodily squat for the user if they have to go back and redo something before submission. they would have to start any files they wanted to upload all over again... Note: I cant turn off autopostback for the controls that use it, it is integral to how the forms work. Yes, I am the highly suggestable type.

    J 1 Reply Last reply
    0
    • V Vodstok

      I have recently created a form that gives the user the option of filling out certain information in either text fields, or as file attachments, or a combination of both. The problem i am runninginto, is that if the user clicks the browse button and selects a file, then hits any of the other controls that do a postback, the selected file is lost. I have tried using this.filefield.EnableViewState = true to see if that would keep, but it doesnt. i also have not been able to progromatically assign a value or a PostedFile.Filename. the page errors out and says that they are not "settable" (gotta love "msenglish") if i could grab the information and pass it to a hidden field, or allow the viewstate to hold it, that would be great. My only other recourse is to make it so that selecting files to upload is the LAST thing that can be done before submission, but that is a pain in and of itself, and doesnt do doodily squat for the user if they have to go back and redo something before submission. they would have to start any files they wanted to upload all over again... Note: I cant turn off autopostback for the controls that use it, it is integral to how the forms work. Yes, I am the highly suggestable type.

      J Offline
      J Offline
      Jon G
      wrote on last edited by
      #2

      This control is extremely protected. What I mean by this is that you cannot set the filename programatically (to avoid any type of "hacking"). The user is the only one that can select the filename. I have encountered the exact same problem, and never came to a solution. This may not be possible with the filefield control. There is also a free control available from metabuilders which brings all the client side options to the server side. You may be interested in trying it out. http://www.metabuilders.com/Tools/FileUpload.aspx[^] Please post your solution if you find one. Jon G www.Gizmocoder.com

      V 1 Reply Last reply
      0
      • J Jon G

        This control is extremely protected. What I mean by this is that you cannot set the filename programatically (to avoid any type of "hacking"). The user is the only one that can select the filename. I have encountered the exact same problem, and never came to a solution. This may not be possible with the filefield control. There is also a free control available from metabuilders which brings all the client side options to the server side. You may be interested in trying it out. http://www.metabuilders.com/Tools/FileUpload.aspx[^] Please post your solution if you find one. Jon G www.Gizmocoder.com

        V Offline
        V Offline
        Vodstok
        wrote on last edited by
        #3

        Thanks! Sorry ididnt respond sooner, but i will definately take a look at this. It never occurred to me that theywould crack down the security so much on the control, but it definately makes sense. Yes, I am the highly suggestable type.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups