Hello,
I am trying to validate the mediatypes allowed in my form. The client wants to validate some types of files, but I have not found a way to validate the files with the .dwg extension. Do you know what would be the exact nomenclature to do it? I use the following property to validate the mediatypes of allowed files: *<property as="xs:string" name="oxf.fr.detail.attachment.mediatypes.*.*" value="application/pdf application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document application/vnd.oasis.opendocument.text image/jpeg application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet application/vnd.oasis.opendocument.spreadsheet"/>* Thanks, Iñigo. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Iñigo,
The mediatype stored by the file attachment control is the one sent by the browser. I.e. there is no sniffing of the mediatype done by Orbeon Forms on the server-side based on the file content. So you can just try attaching such a file, and see what media type you end up with. You'll let me know if this works, or if I misunderstood your question. ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
We have made a test with different browsers (Chrome, Firefox, Opera). We have used a calculated value field to show the mediatype, with the formula you see in the attached image (capture1.JPG). <http://discuss.orbeon.com/file/t375647/capture1.jpg> In all tests we see that the browser sends as mediatype: 'application/octet-stream', as you can see in the attached image (capture2.JPG). <http://discuss.orbeon.com/file/t375647/capture2.jpg> The problem we have is the following: if we put this mediatype in the property (capture3.JPG) <http://discuss.orbeon.com/file/t375647/capture3.jpg> , allows to attach and upload files without extension, and this can not be possible, all the attached files must have an extension. In addition, it allows to attach and upload files with rare extensions ( f.e.;'.dxt'and'.dst'). This can not happen either. What can we do, it could be possible adding our own JS, using a simpleType of an schema XML or another way? Thank you very much. Iñigo. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Hi again,
Following the same theme, we are trying to control the length of the file name adding this formula in the attachment control. <http://discuss.orbeon.com/file/t375647/formula.jpg> I attached an image with two examples with the uploading of the file and the error message of the validation of the length of the file name. <http://discuss.orbeon.com/file/t375647/filesAttachedwithError.jpg> 'Subida de archivos completada' is the same as 'Upload complete'. The validation error appears and does not allow you to go to the revision page, but the file keeps uploading... There is some way to stop the upload of the file when the validation error appears? Thanks, Iñigo. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Iñigo,
To only allow certain file extensions, add a new validation that checks that `@filename` has the proper extension, just like you did to impose a constraint on the filename length. And you can only performs those checks after the file has been uploaded. You can perform checks as the file uploads only through the File scan API (see link below), which is a PE-only feature. This is a more low-level feature, typically used to scan files for viruses, as in case you find a virus you'd like to stop the upload as soon as possible, but the same API can be used to perform other checks. https://doc.orbeon.com/form-runner/api/other-apis/file-scan-api ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |