Forum Moderators: coopster

Message Too Old, No Replies

Attachments

Clarifying available methods and how they work

         

Hester

10:24 am on Jul 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would like to enable a user to upload files from a page. Reading the PHP manual, all I can find is that they require "HTTP POST". The problem is, I cannot use this method of dealing with form data. Is there another way anyone knows of to upload a file using PHP? I am not even sure exactly how it is done. Can someone give a brief overview?

ergophobe

3:49 pm on Jul 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just curious, why can't you use the post method? That seems pretty strange.

Remember, PHP is a server-side scripting engine so, strictly speaking, PHP can not do file uploads.

HTTP does file uploads from web forms. If you can't post, you can't really use HTTP for file uploads from a form. You could upload small amounts sending text by get and then writing it out to a file, but text only and small amounts.

Hester

3:40 pm on Jul 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The situation is that there's a bug in either IE6 or IIS that is stopping forms from working properly. Small amounts of text can be passed, but anything over a certain amount and the browser freezes.

So I've had to create a program that saves text from a form by using cookies and JavaScript. Then PHP is able to read the cookie and pass the text onto the server. Crazy, but it works.

ergophobe

12:12 am on Jul 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




there's a bug in either IE6 or IIS that is stopping forms from working properly

Are you sure about that? Are you just trying to post text? I don't use IIS much, but I can definitely post lots of text using IE6 and IIS.

Not to beat a dead horse with the obvious, but...

- the page validates?
- you've declared the enctype (if uploading more than just text)?

'cause that's just too weird

Tom

Hester

8:58 am on Jul 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, it's a problem that's been reported elsewhere. It'll be fine for some people, others not. Obviously something somewhere needs tweaking, but I'm no IIS expert. And believe me, I've tried everything on the client side to solve this one.

coopster

12:28 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have you tried a different browser and a simple POST <form> to make sure PHP is configured to populate $_POST variables? Are you sure IIS is not configured such that POST is not allowed?

Hester

12:41 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, the problem only affects IE6. It can do POSTs but not if the text is not a small amount. I have studied the PHP ini file and can see nothing to cause this. I used to have no problems using an Apache server with identical POST settings, but only when moving to IIS (not my choice) did the bug strike.

coopster

12:53 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



But, as described, it is a combination of IE6 and IIS. You can upload to IIS just fine, the same exact process, with a different browser?

Hester

1:10 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is correct.

coopster

1:19 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Ouch. Well, about the only thing I could recommend for troubleshooting might be the folks over in the Microsoft Related - .NET and ASP [webmasterworld.com] forum. I also found a couple of MS KB articles that might lead to something...?

Description of the MaxClientRequestBuffer Registry Value [support.microsoft.com]
Maximum URL Length Is 2,083 Characters in Internet Explorer [support.microsoft.com]

ergophobe

4:02 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So strange. I have a site that uploads huge amounts of text via POST and so far no problems with IE6, but it's running on Apache.

RE the threads coopster referenced, they really only discuss problems with sending large amounts of text via GET. POST should have no such limit since the data is not sent as a header at all is it (I believe the post is a separate request with the data in the entity body).

Tom

Hester

9:01 am on Jul 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I made some notes a while ago. Using GET, I can pass 1708 characters from a basic, valid HTML form using IE6 and IIS. If I enter 1709 characters, the browser does nothing. The green progress bars just keep going until the script times out after a few minutes.

With POST, the number of passable characters varies. The most I could manage was 332, using an INPUT form field. Sometimes it would be as little as 235.

All other browsers have no problem.

I've tried everything, from clearing the IE6 cache, to rewriting the form, studying existing forms, following the HTML specs, surfing the web for help. All I found was other users posting about the same problem, so I know it's not just my setup. Indeed I tried it on other computers and they too stuck.

Anyway, it's not a problem now I'm using cookies and JavaScript. (This allows around 4000 characters to be passed.) The only problem is it doesn't allow file attachments to be uploaded.

It's not a crucial issue, so I won't worry if there's no solution.

ergophobe

2:46 pm on Jul 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hester,

I don't want to annoy you suggesting things you've already tried, but have you tried using textarea instead of input? Does that make any difference?

Tom

Hester

8:24 am on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Textarea is what I was using to start with.

ergophobe

2:55 pm on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You say this is a known issue. Just for my own edification, if you have a link to an MS KB article or something like that, I'd be interested. Obviously, if you don't have it handy, don't bother.

Thanks,

Tom