Reputation: 1508
When uploading a file to Google Cloud Storage (through my app running on app engine) I get the following PHP warning
Warning: strpos(): Empty needle in /base/data/home/runtimes/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageStreamWrapper.php on line 168
I've used <form action="<?php echo $upload_url?>
as per the official guide and then done a basic move
$gs_name = $_FILES["uploaded_files"]['tmp_name'];
move_uploaded_file($gs_name, "gs://my_bucket/new_file.ext");
Does anyone know why this is and can someone help resolve this?
Upvotes: 4
Views: 447
Reputation: 41
The same problem... Looks like a bug, in the local (latest) version of SDK different code.
As a workaround I use copy($_FILES["uploaded_files"]['tmp_name'], "gs://my_bucket/new_file.ext")
+ unlink($_FILES["uploaded_files"]['tmp_name'])
, it works :)
Upvotes: 4
Reputation: 4178
Needle is what the PHP strpos function calls its first parameter (search for a needle in a haystack). The value of the $gs_name variable is empty. The cause is likely some difference in the upload form.
Try going back a step in PHP Direct uploads to Google Cloud Storage via HTTP POST and temporarily change your PHP upload handler back to:
var_dump($_FILES);
The output will probably differ from what is expected, and may indicate which part of the above mentioned form is responsible.
Upvotes: 1