File Uploading Madness

The web app on which I’m working will include (sorry for the passive voice) a page for the user to upload an “observation.” As of last week, this small form included:

  • Two menus (Case, Action) from which the user selects … you could think of them as categories or tags
  • A text field to contain a description of the observation
  • Radio buttons that basically state if there are pictures available to support the text that aren’t uploaded (I thought the initial version would be just for text)
  • A submit button

insertObserveSevereCropNoFileInput.png

I came across a tutorial or two showing how “easy” it was to incorporate a file upload button. So I wrote that code and proceeded to test:

  1. It didn’t work
  2. I modified the code
  3. I tested again
  4. Lather, rinse, repeat

After spending hours removing everything (security, etc.) except the bare-bones script to upload the file, and re-testing the form over and over again, I suddenly noticed the Case menu was missing.

So I thought I’d spent hours trying to fix something that wasn’t broken (which happens frequently) because of something I’d never expect. Of course the form wasn’t working, one of the fields wasn’t contributing anything to the query.

Bit o’ Sidebar: Something you need to know is I often struggle with Dreamweaver’s FTP — I often have to close and reopen Dreamweaver to get it working again or use my host’s browser-based upload thingy. But if I’ve closed Dreamweaver and have to reopen it to do some editing so the FTP is “fresh” I’ll use that.

Now my pattern became removing or moving or rewriting the file-upload code, uploading the file to see if made a difference, and so on … based on a couple tutorials I’d found, I thought it was Bootstrap causing this either/or situation — I could either see the Case menu or have the file-upload button, but not both.

Eventually, I realized something even weirder … uploading my PHP file using Dreamweaver, the menu wouldn’t display. Uploading it via the browser, it finally did. Unfortunately for me, just by coincidence (sort of), whenever I put the file-upload field in, I was using the browser to upload my PHP file so the Case menu would appear but when I put the code back in, I was using Dreamweaver so there was a correlation but the cause wasn’t the code, the cause was, somehow, Dreamweaver although I have no explanation for that. Seems stupid but so did the other problem or two.

I still can’t get the file upload to work but at least I can see all the pieces that may or may not be broken.

I kept thinking I should just build a page that just uploads a file with nothing else to see if it would work but I kept thinking, “No, this is a simple problem, any second now, I’ll find the solution … building something from scratch would waste too much time.” Meanwhile, I waste hours … this happens far too often.

So now I’m taking the four best tutorials and I’m going to create each of those things from scratch with none of my code-baggage and see what happens.

Advertisements

About jotascript

Aiming to please. Seeking to impress.
This entry was posted in Frustration. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s