I need to save some image files from user directory to the project folder on server, but I cant find working solution. What is the simplest way to select file in users pc and copy it to the server? And what url may I use to acces this file?
Run an FTP(S) server, and use a Java FTP client to connect and upload the files.
You can make the FTP home directory a subfolder of wwwroot on your server, so you can access the uploaded files as "example.com/diagrams/mydiagram".
Beware though, the client must have the FTP password to connect, therefore your users can upload anything they want (including malicious scripts). If you don't trust your users, you'll need per user auth and verification of the uploaded files, which will require server side code.
Related
I have my desired file in memory on my server. I need to send it over FTP, i cant use anything else for it. I dont want to store the file on my sever and then expose the folder. Is there a way to send over FTP from memory?
How will I ensure the authenticity of users while downloading a file? I am trying to figure out how to design such a system so that files can be securely downloaded with resume/pause capabilities?
Currently, I tried serving the files through my java-middleware so when client requests for the assets, the client will send the jwt token with the request which will ensure authenticity and then java-middleware will connect with the file server which will send back to the response the middleware which in turn server the file to the client.
But the download is consistently failing and not I am not able to provide resume/pause functionality.
I thought of directly serving the files through SFTP server to the client but then how to ensure the request is authenticated is not clear to me.
Can someone guide me what and how should the above download be achieved?
EDIT:
The file downloaded is not static it is dynamically generated per user, and contains meta-data about the user.
To be more precise the file to be downloaded is a .msi installer which should be linked to an account to be installed on the system. Hence I have to package the downloaded installer with the user-authorization account token so that when user double clicks on it should be installed as per user context .
I have a file that changes every day for my website and I want to make a program that takes it from the FTP server and either downloads it to my phone or my laptop.
How would I go about making this and what code do I use?
A few options not already mentioned:
If you have access to the ftp server, a cron job could email the file to you each day.
You could create a web page populated with the data, using jsp, php, or servlet etc. to read the file from disk.
If you're familiar with rsync, you could simply rsync the file to your laptop
Sync the file using Dropbox
I have developed an applet that needs to read in a data file from the user. I have the user pick the file outside the applet and upload it, I then move a copy of the file to the applet folder so I can access it with the applet with only sandbox security. My problem arises from the fact that I run the applet on several hosts. How can I determine the correct host this applet was downloaded from so I can connect to the proper host for the correct data file?
See the Applet.getCodeBase() & getDocumentBase() methods.
I have added functionality which will enable the user to attach a file from web page.
and this file will be sent as an attachment to another user.
When I try this on my local machine it works fine.
I deployed the application on the server.
And when I am trying to attach a file its throwing FileNotFoundException.
Kindly help.
You seems to be reading file system assuming that client is always on server.
Server and Client are different things. Client may be / May not be [all most all the time] on server. You need to upload file then read..
If you can read client's flle system this easily, then we might not have coined the word security