i implementing file upload in google app engine php application. when uploading word file following code:
$bucket = "default"; // process files. $filenames = []; foreach ($_files $file) { $filename = md5(uniqid()); $filename = "gs://".$bucket."/".$filename; stream_context_set_default(['gs' => [ 'content-type' => $file['type'], 'acl' => 'public-read', 'metadata' => [ 'filename' => $file['name'] ] ]]); move_uploaded_file($_files['uploaded_files']['tmp_name'], $filename); $filenames[] = $filename; } $file = $filenames[0]; $fileurl = cloudstoragetools::getpublicurl($file, true);
when download file using $fileurl word says file corrupted. when run hexdump , vimdiff differences in last part of file. file google app engine has following bytes:
0d 0a
at end of file. there anyway rid of other loading file content , trim it? thank you.
Comments
Post a Comment