4 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi..
I have very limited knowledge on LDAP and its configuration and but I have been trying to figure out one issue that takes place when I am running the program that is written in php, but so far its unsuccessful.
The server, I am working on is ldap server, which is running on Apache. After... (1 Reply)
Discussion started by: GomathiUoM
1 Replies
2. Web Development
Hi All,
Frankly I'm new to Linux Environment. While we are trying to Host an ASP.NET 5 Web Application on Centos OS7 Web hosting Server. There were couple of steps which we are supposed to go through, please see this link -
We are stuck at Create a Container & then Running the Container,... (1 Reply)
Discussion started by: John Fredric
1 Replies
3. Cybersecurity
Hello, guys !
The company I work for has a few web hosting servers and I'd like to know how can I secure the servers a little bit ?
The situation is like this:
Apache runs as nobody so all users can run scripts as nobody. This is a big security problem beacause if I have an account on the... (4 Replies)
Discussion started by: Sergiu-IT
4 Replies
4. UNIX for Dummies Questions & Answers
I built my website based on Dreamweaver, on Windows platform. My server uses Unix, and the page doesn't look too good. Is there any way to solve this problem without too much of a headache? (1 Reply)
Discussion started by: PCL
1 Replies
LEARN ABOUT PHP
mongogridfs.storeupload
MONGOGRIDFS.STOREUPLOAD(3) 1 MONGOGRIDFS.STOREUPLOAD(3)
MongoGridFS::storeUpload - Stores an uploaded file in the database
SYNOPSIS
public mixed MongoGridFS::storeUpload (string $name, [array $metadata])
DESCRIPTION
PARAMETERS
o $name
- The name of the uploaded file(s) to store. This should correspond to the file field's name attribute in the HTML form.
o $metadata
- Other metadata fields to include in the file document.
Note
These fields may also overwrite those that would be created automatically by the driver, as described in the MongoDB core
documentation for the files collection. Some practical use cases for this behavior would be to specify a custom chunkSize or
_id for the file.
Note
The filename field will be populated with the client's filename (e.g. $_FILES['foo']['name']).
RETURN VALUES
Returns the _id of the saved file document. This will be a generated MongoId unless an _id was explicitly specified in the $metadata param-
eter.
Note
If multiple files are uploaded using the same field name, this method will not return anything; however, the files themselves will
still be processed.
ERRORS
/EXCEPTIONS
Throws MongoGridFSException if there is an error reading the uploaded file(s) or inserting into the chunks or files collections.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 1.2.5 | |
| | |
| | Changed second parameter to an array of meta- |
| | data. Pre-1.2.5, the second parameter was an |
| | optional string overriding the filename. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
MongoGridFS.storeUpload(3) 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
$m = new MongoClient();
$gridfs = $m->selectDB('test')->getGridFS();
$gridfs->storeUpload('pic', array('username' => $_POST['username']));
?>
SEE ALSO
MongoGridFS.put(3), MongoGridFS.storeBytes(3), MongoGridFS.storeFile(3), MongoDB core docs on GridFS.
PHP Documentation Group MONGOGRIDFS.STOREUPLOAD(3)