I have a form where we can attach files to a post.
But I want to do different things depending wether a file is attached or
not.
So my question is : it it possible to know if a file is attached? I
would say yes, we just need to see if the parameter “file” is empty.
Here are my parameters :
{
“commit”=>“Create”,
“post”=>{“title”=>“Test”,
“subject”=>“desc test”,
“post_attachment”=>
{
“post_id”=>"",
“file”=>"", # <----------- This is the line with the file
“creator_user_id”=>""
}
}
How can I test if the variable “file” is empty or not?
Thank you!