Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!

John Morgan

Ranch Hand
+ Follow
since Jul 31, 2014
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Morgan

Okay... that is kind of what I thought but I was hoping that there was some way of saving to the original location where the file was grabbed in the first place. As the user chose the file they would know the path to the original file. I was hoping to capture that path so the file would be saved to the same location.

I can see why it would be a security risk to know of the client file system, but I would have thought there would be a way to capture a path.

Tim Moores wrote:Yes, it is a security risk for the web app to know about the client file system; that's why browsers don't provide it. It's also not possible to download a file to a location determined by the web app - the browser determines where files go (usually into a user-designated download directory, or onto the desktop).

Currently the path is hard coded into the program. The program to manipulate the spreadsheet is written in Java as it connects to a DB2 database.

Al Hobbs wrote:The stuff you do programmatically you are going to do with typescript/javascript? When you saved the file did you use the whole file path when you saved?
You might not be able to just save the file to their computer.

As a quick note, this would not be a security violation as you already know where the file was located (hence the pop up window) so you would already know where it is (you just browsed to there). So it would be something like:

1) Click button to find file
2) Dialog box opens
3) If suggested directory does not exist, dialog box starts in browser default
4) Browse to location of file you want to upload if necessary (this is the path I need to capture)
5) Click on file (also need to capture file name separate from file path)
6) Do stuff to the file programmatically
7) Save file in the same location as the captured path but with a different file name

I have all but steps 4 and part of 7 figured out.  I can save the file under a different name but the location is incorrect... Saves the file in the root of the project not in the file path where the original file was located.

Hope that clears up what I am trying to attempt.

Tim Moores wrote:

John Morgan wrote:I then need the path returned and the file name (both separate variables).

By "path", do you mean the client-side path of the file? I doubt there are any browsers left that provide that information at this point, as it's considered a security risk. (And most browsers never sent it to begin with.)

I am talking about the path where the file is located on the local disk... i.e. C:\Users\{username}\Downloads
Is there a way in angular to set the default location for looking for a file when doing an upload.

i.e. I click on a button to find a file, a window opens up to browse for files, you chose a file.

I want the same location to open up every time the click on the button.  Right now with windows it opens the last file location that was used.

Can this be done or is it a security violation?
For any in the future that need this... here is a github I found that does what I am looking for....
Does anyone have any code for a file picker in Angular?  Basically I just want a typical bar that you can either enter in the file name or click on an icon to browse for the file. I then need the path returned and the file name (both separate variables).  I have searched around for something like this but all I could find is file upload tutorials, which is not what I want (although some of the components are similar).

Paul you are correct... it was as simple as just converting the string, parsing it, adding the text I needed and then reformatting to complete the name.

Thank you all for your answers here.... now on to my next step.
1 month ago
Thank you... evidently it is something with my set up then and I will have to look deeper into what could cause it.
1 month ago
Added that to my pom and still not converting to JSON. Not sure what I am doing wrong.
1 month ago
here is the complete POM... I did find that the project is using Jersey framework (not something I am familiar with).

1 month ago
Added that in, and still not change.  
1 month ago
I am working through a maven project and was running some test and found that my Jackson annotations were not converting the results to JSON. I cannot figure out what I am doing wrong.


I do know that I am getting:

resultObject "com.dotComIt.learnWith.vos.UserVO@32f8813f"

What I was expecting to get :


Any suggestions?
1 month ago
Is there a way in which a text can be entered in the middle of current text from a certain character?

i.e. I pick a file "test.docx" and want to rename it "test_updated.docx"

I know I can remove the last 5 characters and then add in "_updated.docx" but if I choose a file with a ".doc" or ".1" extension then I need to search based on the period not the length of the string.

Basically I want to append "_updated" to the file name but then still keep the same extension in place. but I also do not know what the file name will be until it is chosen.

Any advice?
2 months ago

Stephan van Hulst wrote:What happens when you invoke the following commands?

c:\>echo %M2_HOME%
C:\Program Files (x86)\apache-maven-3.6.0 MAVEN_OPTS=-Xms256m -Xmx512m

(That is where the file is located)

c:\>echo %path%
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\nodejs;Z:.

Hmmmm and there the problem is... thank you.
2 months ago