PHP » GoLang |
login |
register |
about
|
GoLang MongoGridFS::storeUpload
request it (370)
GoLang replacement for PHP's MongoGridFS::storeUpload
[edit | history]
MongoGridFS::storeUpload(PECL mongo >=0.9.0) MongoGridFS::storeUpload — Stores an uploaded file in the database DescriptionParameters
Return ValuesReturns the _id of the saved file document. This will be a generated MongoId unless an _id was explicitly specified in the
Errors/ExceptionsThrows MongoGridFSException if there is an error reading the uploaded file(s) or inserting into the chunks or files collections. Changelog
ExamplesExample #1 MongoGridFS::storeUpload() HTML form example Suppose you have the following HTML form: <form method="POST" enctype="multipart/form-data"> <label for="username">Username:</label> <input type="text" name="username" id="username" /> <label for="pic">Please upload a profile picture:</label> <input type="file" name="pic" id="pic" /> <input type="submit" /> </form> If you wanted to store the uploaded image in MongoDB, you could do the following in the script handling the form submission:
<?php See Also
|
more
Recently updated
more
Most requested
more
Last requests
|