TYPO3 BE file upload validation - typo3

I want validate file upload in TYPO3-Backend. When a user uploads a file (image) there should be a validation, that fields like "Alternative Text" has to be filled.
I can set
$GLOBALS['TCA']['sys_file_metadata']['columns']['alternative']['config']['eval'] = 'required';
but that does not work by uploading a file but only afterwards when editing metadata.
So can i do it via hook or any other idea?

Related

Workflow to send email with a Saved search CSV file attached

I am just wondering if Netsuite workflow allows us to send an email with a CSV file of a Saved search attached, for example:
We want:
State 1: send an email at a scheduled time using a transactional
saved search as a condition, but instead of attaching a PDF file or
inline text, we would prefer to have a CSV file of all of that saved
search result
State 2: after email is sent, update a custom field
Looking forward to your advices

How to check whether PDF file is password protected or not programmatically in Flutter?

I want to check whether the local PDF file selected by the user is password protected or not in a flutter.
I have chosen a PDF file path by FilePicker and fetched it in the code below.
File file = File(path);
Now I want to check whether my selected PDF file is password protected or not.

How to clear the file data from a multipart jsp

I have a JSP form with form property (In order to submit multiple files) as
enctype = "multipart/form-data";
encoding = "multipart/form-data";
When the form get submitted I'm reading the form data as
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload fileUpload = new ServletFileUpload(factory);
List<FileItem> fileItemList = fileUpload.parseRequest(request);
Now the issue I'm facing is that after the servlet process the request I'm coming back to the same page, after which if the user refreshes the page than based on the previous action performed the form is getting submitted again to the same servlet and I'm again getting the file which has been previously browsed and it's saving again.
Is there is any way we can clear the file information which has been browsed ?
Thanks
Your HTML code would have helped here. However, here is a solution that I think could help you resolve the issue.
You can reset the files associated with the file upload control by using
document.getElementById('yourFileInputControlId').files = '';
This should be done in java script immediately after your file upload request has been handled.(I am considering you are uploading your file using ajax)
If you are actually submitting the entire form rather than using Ajax, I do not see a reason why the file control would not reset. Please provide more details by editing the question if you still face the issue

Drupal 7 form submit handler not executing

In my module, I create a form with a validate and submit handler. The first field is a text input field, and the second is a file upload field.
My validate handler is getting called and exiting fine. My submit handler never executes. I'm taken back to my form, with an error complaining that I need to enter a value in my upload field (as I set it to be required).
I am new to Drupal.
In Drupal 6, file upload fields cannot be required. You should set required = false or else you'll get this error. I think that it's the same in Drupal 7. You should write your own code in the validation handler to check if the file was uploaded.

File uploading and email in JSP

I need to make a simple page in JSP. I've never worked in JSP before ever.
I have a form that has two fields: one is a file upload field and the other is a textbox. The user enters one email address in the field and uploads a file and upon submission. I should be able to email the attachment to the email address entered.
I need a quick code snippet that does this.
try to see this code, might need some debugging though :)
or this one from here (through the JavaMail API):
SmtpSender smtp=SmtpSender.getInstance();
MailToBeSent send=new MailToBeSent();
send.setSubject("Hello");
send.setFromAddress("some#bar.com","Someone");
send.addToAddress("another#foo.com","Anotherone");
send.setBody("Hello, test with the file attachment!");
byte[] bin=.....
send.attacheFile(bin,"photo.jpg","image/jpeg");
smtp.sendMail(send);