What's wrong with it:
action:
$uploaded_files = elgg_get_uploaded_files('upload');
if (!$uploaded_files) {
register_error("No file was uploaded");
forward(REFERER);
}
$uploaded_file = array_shift($uploaded_files);
$file = new ElggFile();
$file->owner_guid = 7777;
if ($file->acceptUploadedFile($uploaded_file)) {
$file->save();
}
form:
echo elgg_view('input/file', [
'name' => 'upload',
]);
Nothing unusual. But I get an error ("No file was uploaded") always.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- ihayredinov@ihayredinov
ihayredinov - 1 like
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
You must log in to post replies.Did you forget to set the enctype on the form?
Exactly! Thank you.