php://input is a read-only stream that allows you to read raw data from the request body. In the case of POST requests, it is preferable to use php://input instead of $HTTP_RAW_POST_DATA as it does not depend on special php.ini directives. Moreover, for those cases where $HTTP_RAW_POST_DATA is not populated by default, it is a potentially less memory intensive alternative to activating always_populate_raw_post_data. php://input is not available with enctype="multipart/form-data".
Hi again,Do either of you know if you can detect the error 1104 when it pops up? I essentially have this script uploading the image every time the camera takes a picture. It works 75% of the time, but sometimes I get an error bubble that pops up for a few seconds then disappears it says, "error 1104" and then says it wasn't able to POST the file. I would like to be able to detect it so I can have the app try again. Any ideas?
-Zach
On Wednesday, February 6, 2013 11:42:55 AM UTC-6, Zach Soflin wrote:
GOT IT! wow that took way too long, but I found a post from Scott that said to try swapping out php://input with php://stdin. It worked! So anyone using host gator make sure to enable always_populate_raw_post_data by contacting customer service and begging and pleading (they are pretty good about it). Then using Scotts example but swap out php://input for php://stdin. Thanks for the direction you two.
-Zach
On Wednesday, February 6, 2013 11:06:19 AM UTC-6, Zach Soflin wrote:
Thanks for the quick reply Taifun,Hum... I contacted HostGator and got always_populate_raw_post_data enabled. Using phpinfo() i can see that it is enabled. I am still getting a blank file in my directory with no errors anywhere. I guess the only problem showing is when I hit the "Post" button on Scotts example, It gives me the error "1104 unable to Post file..." but if I push the button again the response reads "file transfer completed".and the blank file shows up on my web server. Any other ideas? This is stumping me.
-Zach
On Wednesday, February 6, 2013 9:50:46 AM UTC-6, Taifun wrotey to
<?PHP $data = file_get_contents('php://input'); echo $data; if (!(file_put_contents($_GET['fn'],$data) === FALSE)) echo "File xfer completed."; // file could be empty, though else echo "File xfer failed.";?>
always_populate_raw_post_data = On
---sfs
I am also getting the full file name saved with 0kb. Is this a permission issue?
How would I find out if my Android device is sending the full file rather than just the name?
I am also getting the full file name saved with 0kb. Is this a permission issue?in the php script try to replace php://input by php://stdin
Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.
--
(you have received this message from the App Inventor Developers Library)
---
You received this message because you are subscribed to the Google Groups "App Inventor Developers Library" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Where do I put the .php file?
Where do I put the .php file?in a directory onto your web server, which is accessible from the internetTaifun
Hi, I use 000webhost as well. I have tried Taifuns work around uploading PEAR and WideImage(see image) to my server and I still get an error uploading. Do I have to do anything to my server? Please Help.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-developers-library+unsubscribe@googlegroups.com.
--
(you have received this message from the App Inventor Developers Library)
---
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Developers Library" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-developers-library/Sc4a1wZHL-Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-develope...@googlegroups.com.
Install the PEAR package
Hi all,
How to post an image into http://www.example.com/php/example-page.html using script?
@Taifun: okay, sorry for that. Let me try again hahaha
On Sunday, December 15, 2013 6:02:27 PM UTC-5, Taifun wrote:I am also getting the full file name saved with 0kb. Is this a permission issue?
in the php script try to replace php://input by php://stdin
Hmmm... Still get the file with 0kb.When I press the "Post" button, it takes 90 seconds or so before I get the "File xfer completed." message which leads me to believe that the Android app is uploading the full image, but it's somehow not being saved correctly by the server.
require_once (dirname(__FILE__).'/Compat/Function/file_get_contents.php');
$data = php_compat_file_get_contents('php://input');
$filename = $_GET['filename'];
if (file_put_contents($filename,$data)) {
if (filesize($filename) != 0) {
// Do whatever if file uploaded
Scott's original example with the change from input to stdin and php.ini file (to change always_populate_raw_post_data = on) working fine here on an open ftp. Many thanks
That's it, should just work.
Thanks guys
Tim
There's a way to resize the image or shrink its size?
Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
if($_GET['p']==$ACCESSKEY){
// this is the workaround for file_get_contents(...)
require_once (dirname(__FILE__).'/PHP_Compat-1.6.0a3/Compat/Function/file_get_contents.php');
require_once (dirname(__FILE__).'/wideimage/WideImage.php');
$data = php_compat_file_get_contents('php://input');
$filename = $_GET['filename'];
$resfilename = $_GET['resfilename'];
if (file_put_contents($filename,$data)) {
WideImage::load($filename)->resize('50%')->saveToFile($resfilename);
if (filesize($filename) != 0 && filesize($resfilename) != 0) {
echo "File transfer completed.";
} else {
header("HTTP/1.0 400 Bad Request");
echo "File is empty.";
}
} else {
header("HTTP/1.0 400 Bad Request");
echo "File transfer failed.";
}
} else {
header("HTTP/1.0 400 Bad Request");
echo "Access denied"; //reports if accesskey is wrong
}
can you upload the image successfully without using that library?Taifun--
(you have received this message from the App Inventor Developers Library)
---
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Developers Library" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-developers-library/Sc4a1wZHL-Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.