Vayu Robins Posted September 10, 2015 Share Posted September 10, 2015 Hi. I have created a form with the API, which lets users who are logged in to upload files from the front end. I would like to be able to add the filename to the description field, but cannot seem to find a way to do this. When a form i submitted I use this to add a file to the page. $files = explode( "|", $form->get( "cv_file" )->value ); foreach( $files as $file ){ if( $file && file_exists( $upload_path . $file ) ){ $page->cv_file->add( $upload_path . $file ); //$page->cv_file->file->description' = "TEST"; unlink( $upload_path . $file ); } } $page->of( false ); $page->save(); Is it even possible? Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 10, 2015 Share Posted September 10, 2015 $files = explode( "|", $form->get( "cv_file" )->value ); foreach( $files as $file ){ if( $file && file_exists( $upload_path . $file ) ){ $page->cv_file->add( $upload_path . $file ); $page->cv_file->last()->description = $file; unlink( $upload_path . $file ); } } $page->of( false ); $page->save(); 4 Link to comment Share on other sites More sharing options...
Vayu Robins Posted September 10, 2015 Author Share Posted September 10, 2015 Thanks a lot, that works great! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now