0

We have some really old code from which one part like 15k lines of code make a really old fashioned procedural form content menagment system.

Now here comes the stupid part. Whole code is based so it nests form elements. Wich is by definion wrong. we have code like

<form action="demo_post_enctype.asp" method="post" enctype="multipart/form-data">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">
  .
  .
  .
  .
  <form enctype="multipart/form-data">
     <input type='File'>
  </form>

</form>

Now this is only the teoretical layout. the whole thing is so complex and "uniquely" unprofesionally made that my head hurts.

The strange thing is it works, kinda, no idea how. And now we have a problem to upload files bigger then around 28mb. I checked the server settings it is set to 1gb upload size and it works without problems in the new refactored parts it works.

Question:

What is the effective upload size of such buggy code?

We need to give curent users the feedback while the old code gets refactored.

Sangoku
  • 1,588
  • 2
  • 21
  • 50

1 Answers1

0

Although the code doesn't work as intended, it can still work in a sense. As nested forms are invalid, as far as I know all browsers will handle the problem by ignoring the starting tag for the inner form, and end the form at the ending tag of the inner form.

So, as long as the inner form is at the end of the outer form, it will be a single form containing all the fields, and will be posted to the action of the outer form.

While there will be some extra fields included when you upload a file, that would hardly account for so much data that the upload size would be noticably reduced. Perhaps it's the fact that the data is posted to a different page than intended that causes the problem.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • No, the post is happeing on the same handle page. I was thinking that some querqs can happen with IE when the form is made in such a way. ANyone has any info on that? – Sangoku Oct 04 '13 at 09:34
  • I think i got it figured out.. we have more then one file input in the forms and in some constelation the file input names are same. Wchich.... is bad i guess... – Sangoku Oct 04 '13 at 09:49
  • @Sangoku: The only uncertain factor is how different browsers parse the code. Once the browser has decided what elements to create from the code, they work just as usual. You can use a tool like the F12 developer tools in Internet Explorer to examine the elements that the browser created from the HTML markup, to see how the page actually looks to the browser. – Guffa Oct 04 '13 at 09:51
  • @Sangoku: Having duplicate field names doesn't violate anything in itself, but if the server code isn't prepared for it that could naturally be a problem. – Guffa Oct 04 '13 at 09:53
  • I checked it just now. when we have 2 form elements with name file_upload and one is set and one not we get an empty file send from IE.... this could be a quirk from it because it parses the forms strangly. note an empty $_FILE variable – Sangoku Oct 04 '13 at 10:01
  • @Sangoku: Both files should actually be sent to the server, but the server code might only pick up the first one. – Guffa Oct 04 '13 at 10:18