Asp.net mvc - get full file name of uploaded file - part 2 - asp.net

I ask about it here - Asp.net mvc - get full file name of uploaded file but they understood me wrong. Therefore I ask again.
Is it possible to get full file name of uploaded file in asp.net mvc?! For example, "C:\path\path2\fileName3.txt". I need to get "C:\path\path2\fileName3.txt". I think it's impossible.
See this image for details.

It depends on the browser. For some browser (like FF) sending to much information to the server is a security breach. You can read more here.

Related

Rooted Path and FileUpload Control

I know it's been asked and I have read the posts and Googled this all day. Still nowhere near something that works. Using an .aspx page, I need to upload a .pdf file to a specific website. I'm doing development using VS2017 and VB.Net. The app will run on different websites. It needs to upload client files to a specific different website and path. Also, the file name of the uploaded file will not be the same as the local source file. Creating the new name is no problem.
Let's say a local file must be uploaded to a website at https://www.appfileserver.co.za/pdfdocs, but I'm on https://www.myownsite.com. So, when using FileUpload1.SaveAs(rootedpath) the path that goes in there must be the rooted path to the target. What would the rooted path look like for the example I provided?
FYI, I know the IP addresses, http paths and anything else I need to know because I control those sites. It would be great to do an FTP upload. I have done this many times from desktop apps. Unfortunately I'd need the full path to the local file. It seems there is no way a web page is allowed to get that full path, so FTP upload is out - or is there a way?
After battling for two days trying to FTP upload from website to website (which is not possible because server firewalls block this), I finally solved it. The solution was a simple one. I deployed the upload .aspx file on the target server then embedded that in an iframe on the client machine apps. The files are then uploaded one time to the right place. Simple and 100% effective. Hopefully somebody see's this and understands it - so as to avoid the troubles I had.

ASP.Net web application cannot read a file within folder

In my asp.net web application, I read the xml file for obtaining a key. If file is not present I show a form to enter the key details and then create the file.
First problem: My app does not recognize the file even if its there.
Second problem: I am running application on the server. When writing, rather overwriting the file, browser shows the username, password prompt before writing the file. If I enter admin credentials it allows to create a file.
I have checked all possible combinations of permissions on the file / folders, but could not resolve the problem.
Any ideas, what I could be missing here?
You read the xml file but is it as a part of your solution? If yes, are you reading it through relative path i.e. are you using Server.MapPath to read it like Server.MapPath("~/Files.test.xml")? Once you use relative path, I don't think it will ask you credentials as it still is in your project directory.
It should work. I am also reading and writing files in my web application.
If it still does not work, please tell me the way you are reading file.
Thanks,

Ask in a web form for the path of a file accessed from a user's computer

In a web form (aspx) I want to ask the user for the path of a file that needs to be used by one of our team.
At first it was a simple textbox but a lot of people send us wrong path (copy/paste seemed too hard for them).
So I tried to use an input file to be sure the path exists but noticed that the file is then send with the form. As the files can weight hundreds of Mb that was not acceptable.
Then I found a way with Jquery to use the input file to get the path of the file without sending it : it works fine on IE but Chrome translate the path in "fakepath". I understand that it is for security reasons.
So I am again looking for a solution, working on all browser, to get from the user the path of a file (with a specific extension) without him being able to write a wrong path.
I hope someone will have the brillant idea I am unable to find :-).
How about receiving only a few kilobytes of the file data from stream instead of the whole file to ensure the path points to a valid file.

Upload file to server using class dll

It is fairly easy to upload a file using web form. But I need to accomplish this through DLL.
I have classic ASP page with file upload form and I need to create an object that handles the uploaded file from customer and save the file to the server. What would be the best way to approach this? I have been digging and came across Web.HttpPostedFile and HttpWebRequest. but I don't know which route to take.
Also, I am a bit confused about how to pass the uploaded file to DLL so my class can upload and manipulate the file. is there any sample code for this?
Thanks for any help or advice.
This question doesn't make much sense, as you kind of asking "I have old car's parts and I need to assemble one by using a wheel". What? That doesn't make sense.
A dll is a container for some code. You do not use a container per se to upload a file. You should search for "classic asp upload file sample", find a solution, give it a try and come back with a specific problem.
I also noticed HTTPS tag, the idea with S, is that you don't care whether it is secure or not from the programming perspective. If you are able to use HTTP, it is trivial to upload files to HTTPS - just change the URL in the UI. The server code itself wouldn't change. What will change is the server hosting configuration, you would have to add certificate details.

Spring MVC get full file path during file upload

Am using spring mvc and working on file upload. I get the file name successfully passed to my controller and it is of type MultiPartFile. But it is returning only the file name. But i need the path of the file also. Can anyone help me?
From Spring documentation.
"MultipartFile.getOriginalFilename()
This may contain path information depending on the browser used, but it typically will not with any other than Opera."
However what you are asking could be a security concern as you can get file system info in full path beside browser don't generally pass this information. check answer by craigd and others in another question 1130560

Resources