downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoGridFSFile> <MongoGridFS::storeFile
[edit] Last updated: Sat, 07 Jan 2012

view this page in

MongoGridFS::storeUpload

(PECL mongo >=0.9.0)

MongoGridFS::storeUploadSaves an uploaded file to the database

설명

public mixed MongoGridFS::storeUpload ( string $name [, array $metadata ] )

Stores files directly from a POST to the database. For example, suppose you had the following HTML form:

<form method="POST" enctype="multipart/form-data">
     Please upload a profile picture: <input type="file" name="pic"/>
     <input type="submit"/>
</form>

If you wanted to store this upload in MongoDB, you could do:

<?php

$grid
->storeUpload("pic", array("username" => "joe"));

?>

Note that the "name" field in HTML matches the name parameter.

인수

name

The name field of the uploaded file.

metadata

An array of extra fields for the uploaded file.

반환값

Returns the _id of the uploaded file.

변경점

버전 설명
1.2.5 Changed second parameter to an array of metadata. Pre-1.2.5, the second parameter was an optional string overriding the filename.



add a note add a note User Contributed Notes MongoGridFS::storeUpload
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites