I am trying to upload image from Google App Engine using PHP. Image is
getting uploaded to proper cloud storage bucket path, but it is not
accessible as it contains error. When I am uploading 800kb size image, it
is showing 12 byte to cloud storage. I've also tried to upload 1kb size
file, even though it is showing 12 byte size. I am not getting the exact
issue. Here is my code for uploading image to google cloud storage:
Here is my code :
$file_name = $_FILES['filetoUpload']['name'];
$temp_name = $_FILES['filetoUpload']['tmp_name'];
$type = $_FILES['filetoUpload']['type'];
$options = array('gs' => array('entity' => 'allUsers', 'role' =>
'READER', 'acl' => 'public-read', 'Content-Type' => $type, 'contentEncoding' =>
'ANSI'));
$context = stream_context_create($options);
$publicFileText = date('ymdhis');
$fileName = "gs://<bucket-name>/" . $file_name;
file_put_contents($fileName, $publicFileText, 0, $context);
$publicUrl = CloudStorageTools::getPublicUrl($fileName, TRUE);
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/c3bd76dd-0ead-4788-9bd4-c2a9f2813c96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.