|
MongoGridFS::storeUploadStores an uploaded file in the database Description
public mixed MongoGridFS::storeUpload
( string
$name
[, array $metadata
] )Parameters
Return ValuesReturns the _id of the saved file document. This will be a generated MongoId unless an _id was explicitly specified in the 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:
<?phpSee Also
|