Upload function using forms publisher with the <browser> - teamsite

What necessary steps must be taken in order to upload a file from local machine to ContentCenter using Forms Publisher to create a DCR. As far as I understand the instance only lets you browse files within the specified workarea. What I would like to do is use it to upload an image instead to a specified folder in the workarea instead.
Can anyone provide me with the steps/examples to solve this? Would be really appreciated.
Thank you.

You can do that with a custom plugin in Tiny MCE. Create a sevlet
that has a browse button with upload functionality to teamsite
workarea. Call that in Tiny MCE on click of an icon.
You can also create a CGI and call it in datacapture.cfg using callouts.
Let me know if you need more details.

Related

Insert image to CKEditor

I trying to use CKEditor5 and CKEditor-react in my electron app.
And i want to paste image in editor, but i have an error
filerepository-no-upload-adapter: Upload adapter is not defined.
Docs says that I mast using cloud. But my app must working locally and without internet
Can someone help me?
The docs say, in short, this:
To handle image upload in CKEditor 5 you can use one of these:
use the built-in Easy Image adapter (cloud service),
use the built-in CKFinder adapter (can work locally if you want),
write your own adapter (in which case, please refer to the UploadAdapter interface documentation).
The last option gives you a complete freedom on how and where you want to send those files.
PS. You can find a bit more details in this question: How to enable image upload support in CKEditor 5?

Using Javascript to download file in Wicket

I am confused on how to do this.. Currently I am implementing an automatic download using Javascript:
target.appendJavaScript("location.href='"+ "./Access.xls" + "';");
This doesn't work.. What is the proper way to trigger an automatic download and how do I properly set the url? I am not too familiar with Javascript but trying to implement this. The file is in the root of the project.. but it tells me it is not found.
Also, when the user downloads it, I would like to then delete it right away after it is downloaded using Javascript, how can I do this? I am using Javascript because I am calling this file within an ajax method.
Thanks!
The best way to get access to that resource, you should use a ResourceReference as explained here. To get the url of a ResourceReference use:
RequestCycle#urlFor(ResourceReference, PageParameters)
However, I don't understand what you need regarding deletion of the file once downloaded. If your file is contained in the jar/war of your project, I don't believe it can be deleted from inside the web app. You could block access to it once it's downloaded however, if that makes sense. Not sure what you're trying to achieve here.

How to receive a file after drag and drop

I'm trying to build a web application that allows users to drag and drop a file from their desktop (like justbeamit.com) to an "icon" that represents another user, and so that the different user could receive it on the other side. I see that this is possible using the dropzone.js feature, but I want to know is how it's possible to link this with the receiving function so that the other user could download it simply after receiving a notification. I know it sounds complicated, but wish you guys could do good on me by providing knowledge on how to link the drag and drop functionality with a function that allows the other user to receive and download the file. Thanks!
If you are using MVC framework you can get the file from controller as body.request.body.dataParts.get

Upload pdf on a server with Spring MVC

i try to create a web site where it will provide an option to the user to upload a pdf file. I want this pdf to be saved on the server with specific url. For example:
The user select the title.
The user upload the file.
I want after these actions the file to be accessible via a specific url/name_the_user_give.
I saw that the Spring MVC provides very easy interface for file uploading.I already see many tutorial about this but my problem is how can i save the paper into a server.Also i want the pdf to open by the browser's tools.Can anyone give me directions?
To save the file on server path you simply needs to write the file stream to the path described by
request.getServletContext().getRealPath("your directory name here");
and then create the file using the real path you get.
And to show the pdf file using browser plugin, you should use following in your controller method.
#RequestMapping(value="url to map", produces={"application/pdf"})
Hope this helps you.
Cheers.

Logging image downloads

I'm trying to find a way of finding out who is downloading what image from an image gallery. Users can download using a button beside the thumbnail or right click and use the "save link as" Is it possible to relate a user session or ID to a "save link as" action from all browsers using either PHP or JavaScript.
Yes, my preferred way of doing this would be via PHP. You'd have to set up a script which would load up the file and send it to the user browser. This script would also be able to log the download somewhere (e.g. your database).
For example - in very rough pseudo-code:
download.php
$file = $_GET['file'];
updateFileCount($file);
header('Content-Type: image/jpeg');
sendFile($file);
Then, you just have your download link point to download.php instead of the actual file. (Note that updateFileCount and sendFile are functions that you would have to provide, of course - this script is an example of a download script which you could use)
Note: I highly recommend avoiding the use of $_GET['file'] to get the whole filename - malicious users could use it to retrieve sensitive files from your web server. But the safe use of PHP downloads is a topic for another question.
You need a gateway script, like ImageDownload.php?picture=me.jpg, or something like that.
That page whould return the image bytes, as well as logging that the image is downloaded.
Because the images being saved are on their computer locally there would be no way to get that kind of information as they have already retrieved the image from your system. Even with javascript the best I know that you could do is to log each time a user presses the second mousebutton using some kind of ajax'y stuff.
I don't really like the idea, but if you wanted to log everytime someone downloaded an image you could host the images inside a flash or java app that made it a requirement to click a download image button. That way the only way for them to get the image without doing that would be to either capture packets as they came into their side or take a screenshot.
Your server access logs should already have the request for the non-thumbnailed version of the file, so you just need to modify the log format to include the sessionid, which I presume you can map back to a user.
I agree strongly with the suggestion put forward by Phill Sacre. For what you are looking for this is the way to go.
It also has the benefit of being potentially able to keep the tracked files out of the direct web path so that they can't be direct linked to.
I use this method in a client site where the images are paid content so must be restricted access.

Resources