Login   Register  
PHP Classes
elePHPant
Icontem

POST file chunked

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP HTTP protocol client  >  All threads  >  POST file chunked  >  (Un) Subscribe thread alerts  
Subject:POST file chunked
Summary:I want to POST a file chunked
Messages:8
Author:Marco van Rooij
Date:2011-09-20 23:18:05
Update:2012-04-26 08:48:05
 

  1. POST file chunked   Reply   Report abuse  
Picture of Marco van Rooij
Marco van Rooij
2011-09-20 23:18:05
First I want to say that I really like this class. Very useful.

I want to upload a file with POST to a particular webpage.
With small files it works fine, but with larger files it gives me:

S HTTP/1.1 413 Request Entity Too Large

I found out that the file should be uploaded 'chunked' but is it possible to do that with this class?

Thanks!

Regards,

Marco

  2. Re: POST file chunked   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2011-09-21 05:28:35 - In reply to message 1 from Marco van Rooij
It seems you are exceeding the upload file limit.

I never heard of chunked file uploads until now. Which Web server supports such kind of uploads?

  3. Re: POST file chunked   Reply   Report abuse  
Picture of Marco van Rooij
Marco van Rooij
2011-09-21 06:43:23 - In reply to message 2 from Manuel Lemos
IIS 7.5.

I already asked the admin to increase the UploadReadAheadSize setting but I don't think they are going to do that.

  4. Re: POST file chunked   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2011-09-21 07:20:26 - In reply to message 3 from Marco van Rooij
OK, but is there any browser that supports those chunked file uploads?

I also have not found any RFC that define how such chunked file uploads work. Do you have any idea?

Would you control to scripts that could run on a IIS server to test eventual support to chunked file uploads in HTTP class?


  5. Re: POST file chunked   Reply   Report abuse  
Picture of Piotr
Piotr
2012-04-19 13:01:06 - In reply to message 4 from Manuel Lemos
Hello
I tried to use PHP HTTP class to send files to another server (server B). Everything works if the file is located on server A and is a path to this file.
My questions is:
It is possible directly upload the files from multipart form to another server (server B)?

  6. Re: POST file chunked   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-04-20 05:47:51 - In reply to message 5 from Piotr
Well it will work if you give it the correct path of the uploaded files in disk.

  7. Re: POST file chunked   Reply   Report abuse  
Picture of Piotr
Piotr
2012-04-23 08:16:53 - In reply to message 6 from Manuel Lemos
I need to prepare a script that runs on server A to save the POST data. The other hand, saves files to the server B. I do not want first to write files on the server A and later copied to B.
You think that's possible?

Can you give an example how to do it? How to specify the path to the uploaded file?

<?php
require("http.php");
if(isset($_POST["ok"]))
{
set_time_limit(0);
$http=new http_class;
$http->timeout=0;
$http->data_timeout=0;
$http->debug=0;
$http->html_debug=1;

$url="http://serverB/test_post_return.php";
$error=$http->GetRequestArguments($url,$arguments);
$arguments["RequestMethod"]="POST"; //<-- it WORK and variables are sending

Similarly, I try to file but it does not work. I give error 'it was not specified the file part name'
$arguments["PostFiles"] = $_FILES;
How to specify the path to the file transfer that is in the tmp folder?
When I submit form (server A) file is writing in tmp on server A or B?

  8. Re: POST file chunked   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-04-26 08:48:05 - In reply to message 7 from Piotr
I am not sure what you mean, but when PHP handles uploaded files it necessarily creates temporary files. If you want to re-upload those files to another server, you can use the path of those temporary files.

The PostFiles argument is an associative array of files to upload but it is not the same as $_FILES. You need to map the file names from $_FILES the structure that PostFiles should have. Take a look at the test_http_post.php script to see how you should do it.