PDF Attachment problem

Hi All…

Newbie on the block alert!..

I am wondering if anyone is able to help me here…I run a php forum and I have, in the past uploaded PDF files without difficulty, but now im getting the following error message

[size=14pt][size=12pt]Bad Request[/size][/size]
Your browser sent a request that this server could not understand
Apache/2.2.3 (CentOS) Server at lws02.netbenefit.co.uk Port 80

My host suggests the problem lay with PhP…PhP have suggested it could be down to the host…so Im not really getting very far…

I am no technophobe…but the world of PhP forums and web space MYSQL etc is new to me…but I learn fairly quick.

Is their anyone able to help?..

Many thanks…

Well, that was not PDF PHP code. It looks like you have a size tag error. You show STYLE’s size and then end a size tag…

If you want help, show us the code (a few lines before and after) where the error occurs.
And, please place it inside the PHP tags above!

Then, we can help…

Thanks for the reply Ernie…

Mistake on my part sorry…I accidentally left those tags on after emboldening and increasing the font size the ‘Bad Request’ text…

This…is the only error box that comes up after I attempt to add the PDF to a thread…

Bad Request
Your browser sent a request that this server could not understand
Apache/2.2.3 (CentOS) Server at lws02.netbenefit.co.uk Port 80

Not much to go on I know…but no one, including my hosts seem to have a clue what it is or means…

Hope that helps…

Well, I did some Google surfing and that error is mostly do to “Header Size”.
Hmmm? You head is too big! LOL…

Well, actually this means that you are either sending a file that is over the size max for the server.  This is set either by the server itself or by your code.  (Either can set a limit on sizes of uploaded files.)   So, to debug this, first I would try to send a very small PDF.  If that goes thru, then we know where to head.

Next, it could be the actual encoding of the file. When you upload a PDF, certain type of coding can be used. I usually 8k chunks which seems to work. If you are not “chunking-up” the file, that is probably the problem. (Packets can over-run and cause weird server errors!)

Lastly, it is possible you are creating a header that has some odd thing in it. We would have to peek at your headers…

Well, there are some thoughts to start with. I am leaving for a few hours, but, will check in when I get back…
Good luck…

Hi Ernie…

Thanks for that fella…

I did some experimenting…I tried adding a PDF and increasing the file size a little each time…it messed up somewhere between 400 and 600 Kb…

Which would make your theory spot on…however, one small snag…I have already posted two much larger files (1 Mb+ ) into the same forum area…I spoke to the hosts a while back and they said they was plenty of memory…and also confirmed that I could not post anything bigger than 2Mb anyway…

So it seems we are on the right course…even though the ability to post bigger files has thrown a little problem in to the mix

Can you tell me what my next step is…please bare in mind though, although im not a phobe a lot of this terminology is new to me…so apologies for my ignorance of these matters (at the moment)

Cheers for the help so far… :slight_smile:

No problem! You are welcome…

So, the next thing is to check the max size that is set for uploads.
My guess is that it has changed. You can do that in your upload php code.
It is usually easy to see in that code as it says something like “Max_Size=600000” or something similar.
I think the size is in k’s. If it is in megs, it would be 1m or whatever…

This can be set in your PHP’s server INI file. It is called PHP.ini and is usually in the root of your server.
Or, it can be placed in the .htaccess file (no extension, the entire name is the extension!)…

So, to debug, first look at your upload code and see if it has a limit set in it.
Next, look at the PHP.ini file in your folders online to see if it is set there.
Lastly, look inside the .htaccess file for the limit.

Please make sure you do not change anything other than the limit in the PHP.ini or .htaccess files as it will muck up your server system…

Good luck…

Once again many thanks for such a prompt reply…

I hope you aint been sitting there all day waiting for my response! ;D

I will try that out and get back here…(assuming I dont blow the whole of the UK’s internet system to bits!)

I noted earlier that I was actually in the wrong place for help forums when I looked into this site more…I just saw the words PhP in Google and went for it…assuming it was orientated toward PhP style forums themselves…

So on the strength of that thanks for baring with me…its really appreciated.

Well, help is help no matter where you get it… A large number of people ask a strange variety of questions here. And, most always someone will post an answer… This seems to be a nice place to visit…

Let us know if you solve it…

Sponsor our Newsletter | Privacy Policy | Terms of Service