I need to validate content of pdf file sent by "File Attachement" component, using Webservice, uploaded by user.
How to do that ?
Action Value Change is not called
ver.orbeon-4.4.0.201311042036-PE
Thanks
Piotr
That probably requires a few steps:
Determine when the upload is complete. With recent versions of Orbeon Forms, the eventxxforms-upload-done can be used.
Send the content of the uploaded file to a service. The file can be a binary file, but there is a way to submit binary content.
Depending on what the service returns, mark the control valid or invalid. You could do this with an attribute on the element holding the uploaded file's URL, e.g.: <my-upload valid="true"/> and then use a constraint like constraint="#valid = 'true'".
Related
Im developing small admin panel with react-hook-forms form. In creates form I add to my subbmiting object array with files and img file. It is look like {arrFiles:[File, File, File], img:[File]}. For sending files to server I use base64. So its OK. But Im working with edit form right now. And I need to take default files values from server: file name, path in server and file date. How I can take this information? I thought I have to forming on server object for the each files like this {fileName:"name", path:"url/name.jpg", body:"base64...***"}. What do you think about that practies. Is this ok?
Is there any way to get automatically the content of the log view in OMNeT++ presented below into a file (any type, even in a text file)?
Note that I am not talking about the .elog file generated automatically by OMNET++.
No, there is no way to automatically write the content of Log Viewer in Message mode.
We have a integration requirement to move files from one folder to another in SharePoint Online. The new file name in the destination folder needs to be suffixed with the current datetime. For instance, if the source filename is Myfile.csv, it should be moved with the new name Myfile_2021-04-15T15:39:23.csv to the destination folder.
Using the Logic App SharePoint Move file action, I haven't been able to achieve this
If another file is already there is an enum and I'm unable to provide a custom expression for it. Further, with this option files are only renamed if there's a file with the same name already existing in the destination folder. Whereas our requirement is to attach datetime to all files that are being transferred, independent whether the file already exist in the destination folder or not.
How can I best achieve this?
Thanks in advance for any assistance.
Since the "Move file" action doesn't provide a feature for us to specify the new file name, I think the requirement can't be implemented by this action. You can just use other action to do it.
For example, use "Get file content" action to get the file content.
Then use "Create file" action to create the new file in the location which you want.
You can specify a name which you want in the "File name" input box.
By the way, the "Get file content" action doesn't provide an expression of file name for us to use in second step. But I noticed that you have got Full path in your description, so you can substring the Full path to get the original file name. And then use utcNow() method to get the current date and append it to file name.
I am not getting any warning or error message while executing the program.
wd.findElement(By.xpath("XPATH")).sendKeys("ABC.jpg","XYZ.jpg");
But no file is uploading.
wd.findElement(By.xpath("XPATH")).sendKeys("can we make CTRL+A operation" );
Thanks in advance.
I think you may be going about this while "file upload in Selenium" thing wrong, so that's what I'm going to address.
This article by SauceLabs covers the basic steps to handle a file upload through Selenium in both Java and Ruby. Assuming you're using Java, there are a few steps you'd need:
Set the FileDetector method for your WebDriver
Get a WebElement pointing to a valid HTML input tag of type file
Have Selenium type in the file's path (Not sure if this requires absolute paths, but it's probably a good idea)
Submit the form
The following code listing demonstrates how to perform each of these steps:
wd.setFileDetector(new LocalFileDetector());
// point your webdriver to the page containing the upload form.
WebElement upload = wd.findElement(By.xpath("XPATH")); // TODO replace xpath!
upload.sendKeys("/path/to/ABC.jpg");
upload.submit(); // NOTE: Submits the form *containing* the upload field!
Because you've set the file detection method to LocalFileDetection, Selenium will be able to find the appropriate file. If this is not set, then Selenium defaults to the UselessFileDetection implementation, which fails every time to avoid accidental file uploads.
Caveat: If you're using a Javascript or Flash-based multiple file upload system, then this probably won't work, since those typically bypass the original input field or handle upload independently from the form's submission.
You are not getting an error because sendKeys() accepts an array of CharSequence objects. and you are conforming to that method contract
But no file is uploading
That is because the way your code is written now, will actually send the text: ABC.jpgXYZ.jpg.
What function in Drupal gets file attachment path?
Edit: the attachments provided by Upload module in system section. But since you mentioned there may be another way around it. Maybe I could achieve may goals using FileField module so if you could tell me how to get a direct link of a file uploaded by FileField module that may also be very helpful.
Edit 2:
Ok I will start from my main and final objective:
It is to get an image linking to a file which visibility I could be managed using CCK module.
I am doing this step by step. So now I have written a code which generates the needed image and I have added that image to one of content types teaser. I found a way to warp my image in a tag and I had dug up simple attachments url. So my next step is to advance from simple upload attachment to the one added by FileFields and from odd looking HTML pace in all PHP document into beautifully managed CCK field.
How to fetch file path of a file uploaded FileFields?
Some plain and at the same time rich tutorials for making custom fields for CCK module.
Assuming you know how to get the $node object for a node containing a file attachment, this is super easy:
Upload (core)
$file = upload_load($node);
echo $file[1]->filepath;
Where 1 is the index of the file. Upload can let you upload more than one file, so file 2 would have an index of 2 and so on. If there's only one file, it'll always be 1.
More info: upload_load() API reference.
FileField
echo $node->field_fieldname[0]['filepath'];
Where field_filename is the short name you've used for the field, and 0 is the index of the field. CCK fields let you have multiple values in one field, so 0 would be the first, 1 would be the second, etc. If you only have one value, it'll always be 0.
Note: if you want to get the rendered output of the FileField using its formatters, you can just use $field_fieldname in your node template, or if you want to store the rendered output, you can use:
echo content_format('field_fieldname', $node->field_fieldname[0]);
More info: content_format() API reference.
Upload is a sad little module, and has been completely replaced with a core implementation of FileField in Drupal 7. If you have the option to use FileField, you should.
Don't direct links of file attachments appear below the uploaded file for the core Upload module?
Since you are trying to use images, you should use http://drupal.org/project/imagefield CCK module in order to add images to specified content type. After that using the Display fields tab in Content type configuration you can specify how image would be presented (as a link, image, image with link to node...) both in teaser and body view.