So I have a java webapp that lets the user upload a file to a server. I am using apache commons library FtpClient to do that.
I want to be able to match the uploaded file with the user of my website (the web app is only accessible from within the user area on the website). The website and whole user-interaction and management is in PHP / MySQL. So basically, I want to match the file uploaded in the Java webapp with the user in MySQL table who uploaded it.
How should I use PHP on the server to grab that file and match it with the user? Or maybe it's more convenient to do that from Java application somehow? Which approach do you suggest?
You could call a JSP by post with the file name that has been uploaded and the user name or the user id, This can be used to update or insert into a database where you can save the relation between the file and the user.
Hope this solves the issue.
Related
I am doing project using jsp in netbeans8.2, tomcat8, java, MySQL(xampp). I have done the coding till multiple file uploads. Now I want to send email to respective user mail id, once file uploads into MySQL database. I searched but on internet but I got for only one user mail id. I need for all users who will upload one or multiple files then immediately mail notification should be sent. Is there any tutorial or suggest me any tutorial(link) that I can refer to solve my problem??
It depends which framework you are using, there are multiple ways to achieve this.
In case you are using Spring Framework use this tutorial
https://www.baeldung.com/spring-email
https://www.javatpoint.com/spring-java-mail-tutorial
In case Plain Java
https://www.baeldung.com/spring-email
Happy to help further as and when needed.
I have a web application running on Weblogic 12c using Java7 as backend and angularjs in front end.
I want to be able to download/upload one (pdf) file from it.
The basic user cases are :
The user can click on a button to download the file.
The user can click a button and pick a local file, this file will then be uploaded and replace the previous one as the downloable file.
There will only be one file.
I've tried to find a solution online and I ended up creating a File Store (with a direct-write policy).
But I haven't found how to download the file when using my application.
Also, I'm not sure this solution will work for my upload case.
How can I et up my application to download/upload this file ?
Filestores are a wholly different concept, used to store JMS messages. Don't let the name confuse you, this is not a usecase for filestores.
Consider this Q for handling the file upload: How to upload files to server using JSP/Servlet? - and save the file on a folder in the filesystem. Your WebLogic 12c installation supports servlet 3.0 annotations.
I have a website where users can upload resources (e.g. pdf-files) to their account. I am using AWS S3 to host all the uploaded files, and I am using the AWS Java SDK 1.8.9.1 for communications between my website and S3.
Now, I want to allow users to be able to download and view the files that they have uploaded, but I only want this to be possible through my website. That is, on my web site, users should have a download link for each of their files that they can click, after which the download starts. However, if they copy the URL of the download link and send it to their friend, that friend should not be able to download the file.
I know that it is possible to restrict access to S3 buckets to specified referring URLs. However, I have also been told that this can easily be forged and is not the way to go. I am thinking that there might exist a solution with signed requests.
How can I achieve this?
You could modify your application so that the download links are proxied through it. i.e. The application should do the reverse of the upload process.
So, you can provide a link to your java application, which will then go to S3 and retrieve the file and return it to the user. This way, if someone shares a link, you can protect the url and require users to login before they can download the file.
I am trying to develop a J2EE web application which reads files from the local machine. The user will be able to enter a path where the file exists and when a button is clicked, the file is read and a database should be uploaded. This feature works fine when I tested it locally, but when I moved the code to the web server, it is not able to find the file. This is because the application is trying to find the file at the server and not the local machine. Could some one please let me know if there is any way I could read the file from the local machine?
I ve been using struts/tomcat for developing this application
Thanks
An option: Check out this Rose India article
Another option: do a google search for "file upload jsp"
try
<input type="file"/>
It is impossible to read a file on a remote computer without sending it to the server... obviously!
Local file access is usually permitted if you run the browser App from the local file system, and not thru an Web server.
i would like to know if it is possible for me to upload say a text file on the web server of my webhost (000webhost.com) directly from my mobile phone java application. Actually i want this java application me and my college friends are developing to send a text file to the web server that would be plotted by this applet on the website. I somehow need to get the text file from java (mobile phone) to the webserver . Now the url the java application should access is net2ftp.com which asks for a few details like username, password, FTP server etc that should be auto entered by the java code (like these details are provided in the java script and it logins me in automatically) the next page after login is net2ftp.com/index.php which has an upload tab ...this tab should also be auto clicked by the java script and then it asks me to choose the file to upload and then click the upload button.....does any one has any idea if
a) this approach is practical?
b) any scripts you have ever come across that could help in achieving this ?
this could help..
the sample is from Nokia, you can use this to upload a file to a http server,
this might help regarding the authentication bit.