Paul Clapham wrote:No runtime errors? But you're catching them all and storing them; are you sure your code is actually looking at them and telling you they exist?
If so then it looks like line 80 isn't ever being executed. If you work your way back up the code you could look at all of the if's and while's which you are assuming act the way you think they should act, and perhaps they are acting differently for some reason which you have overlooked. It's also possible that you have misunderstood what folder the files are being written and you're looking in the wrong place for them.
Paul Clapham wrote:
If this variable remains null then the upload won't be done. I don't see any code which sets its value, but then you didn't post what you said you posted just now...
Paul Clapham wrote:
If this variable remains null then the upload won't be done. I don't see any code which sets its value, but then you didn't post what you said you posted just now...
Paul Clapham wrote:Okay. You've posted a lot of code but you haven't said how it's called. For example it's not obvious in which order the various methods are called. Presumably the data ultimately comes from a servlet request, and passing an HttpServletRequest reference as a parameter shouldn't cause any problems. However storing that reference until after the request has been completely processed might cause problems, I suppose. So did you do that?
By the way your use of capitalized names like SwitchFormProcess for method names, I find that very distracting. The standard of lower-casing method names (like switchFormProcess) is so widespread that it's actually hard for me to follow programs that don't use that standard.
Paul Clapham wrote:When I was writing code to process file uploads I recall that I had to take great care to handle the form parameters and the file upload parameters at the same time. Sometimes the relevant form parameters came after file upload parameters which needed to know them, but that wasn't a big problem. But yes, you can only process the parameters once, so your efforts to implement something which processes the parameters twice are going to be in vain.
If you consider that allowing the parameters to be processed twice would require the server to stash away a possibly enormous chunk of code (the upload request includes the entire contents of the file being uploaded) so that it could go through it a second time if the user needed that, you can perhaps see why it doesn't work that way.
Michael Portman wrote:Maybe I should write a special method which processes both the formdata and fileupload at the same time?, instead of doing it separately like ive been doing. Would you agree to that?
Paul Clapham wrote:
Michael Portman wrote:Maybe I should write a special method which processes both the formdata and fileupload at the same time?, instead of doing it separately like ive been doing. Would you agree to that?
Absolutely. I'm almost certain that should work for you, although it would require a rewrite of what you've got so far. But fortunately you don't have a whole ton of code to deal with.
Paul Clapham wrote:It seems to me that you have to use the POST method when you're uploading a file, but I could possibly be wrong about that.
Anyway... I'd suggest writing some simple test code to find out answers to questions like that. Write really, really simple test code, just enough code to test a hypothesis.
Michael Portman wrote:So grabbing GET data from the URL works even when the form is a POST multipart. With working it will make my life a whole lot easier lol.
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|