dennis
dennis

Reputation: 630

php google app engine uploading files on local dev server

On my local google app engine server (1.9.0) (PHP 5.4.6-1ubuntu1.7) I always get message/external-body as mime type for uploaded files and the tmp_name does not have gs:// wrapper as it is supposed to . E.g:

[type] => message/external-body [tmp_name] => /tmp/phpFbTDzF

Where it should be (as on the production app engine):

[type] => text/plain [tmp_name] => gs://coscms-bucket/L2FwcGhvc3Rpbmcy...

Files are uploaded local, but it is just difficult to test it, when you don't get the right file names (gs://).

When deployed I get the correct mime type for uploaded files. Here is my test script:

<?php

use google\appengine\api\cloud_storage\CloudStorageTools;

$bucket = 'coscms-bucket';

if (!empty($_FILES)) {  
    print_r($_FILES);
}


$options = [ 'gs_bucket_name' => $bucket ];
$upload_url = CloudStorageTools::createUploadUrl('/test.php', $options);
?>
<form action="<?php echo $upload_url?>" enctype="multipart/form-data" method="post" accept-charset="utf-8">
Files to upload: <br>
<input type="file" name="uploaded_files" size="40">
<input type="submit" value="Send">
</form>

Upvotes: 2

Views: 512

Answers (1)

Stuart Langley
Stuart Langley

Reputation: 7054

We're working an a php-cgi binary to distribute with the linux SDK that will fix this problem.

Until then if you can test on mac or windows it'll work correctly in the development environment.

Upvotes: 2

Related Questions