I am pretty new to Elgg and I am trying to allow users to upload a video. My problem could also just be php related, however.
So I have set up my form with the following code:
echo elgg_view("input/file", array('name' => 'video', 'accept' => 'video/*'));
which sets up a control to allow users to upload files. My action file is filled with a lot of defensive programming to ensure that the file is there. When I try to upload a video, I get the following error which points me to this snippet of code:
// must not be empty if a file is present in the upload
if( empty($_FILES['video']['name']) ) {
$error = elgg_echo('No file to upload!');
register_error( $error );
forward( REFERER );
}
I am completely lost at where the problem may lie, I have been trying to achieve this for about 2 days now. I have been referring to a bunch of other plugins which make use of file uploads in Elgg, such as the file plugin and the TidyPics plugin.
All help and tips are appreciated in advance. Thank you.
According to http://docs.elgg.org/wiki/Forms
Enctype form attribute (defaults to blank). You will need to pass a value of 'multipart/form-data' if you want your form to do a file upload.
try-
echo elgg_view('input/form', array('enctype' => 'multipart/form-data', ...));