How to upload pdf file into my own server? - asp.net

In my site, user want to upload a pdf file and I have to save it into my own server. I don't need the content to be saved. I want the exact file to be copied into my server where the published file of the site exists.How to do this?

Use FileUpload Control and write code like
FileUpload1.PostedFile.SaveAs("Path and Filename");

You can easily use asp.net fileupload control: Uploading files in asp.net using C#

You can use ASP.NET file upload control which will handle this.You can mention where in your server you want to store it

Related

How to auto-upload files to a server from a local directory in ASP.NET

I am trying to upload an image from my computer to hosting server using ASP.NET code, but I don't know if it's possible.
If it is, can you help me?
Sure it's possible. Read up on how the FileUpload class works: https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.fileupload?view=netframework-4.8
It won't be an automatic upload like you ask in the title, but you will be able to send files thru the browser and wherever you want them to go.

asp FileUpload Server control fakepath

In a asp.net FileUpload server control, when I upload a file, the whole path of the file appears. But I do not want to show the full path.
I want to show something like c:\FakePath\FileName.
Is it possible? and if yes how.
Thanks

ASP.NET FileUpload caches files?

I have a form with FileUpload control. Say, user chooses a file from his local disk, uploads it and then my site tells him that the file is in wrong format. The FileUpload control still retains the path to file.
Then the user makes neccessary corrections to his file and presses the upload button, assuming it will grab the updated version of his file. But the server still receives the old version of file, which is without user corrections! I even noticed that you can even rename or delete the local file after choosing it with FileUpload and it will still upload.
So my questions are:
Does FileUpload control cache files in some fashion?
Is this ASP.NET functionality or it's present in basic HTML control?
Can I remove this caching so that server always gets the latest version of the file?
Try using fileuploadId.Dispose() on pageload to clear the control.

Asp.net : Upload directory using c#

I have have a solution now to upload multiple files using (drag drop) technique by JavaScript and jQuery, but I need to find a way to upload folder with all of it is content like Google drive . Is this possible?
Unfortunately you can not do this, only with a browser.
You will have to use a custom client for this.
But a simple method will be Ask the user to ZIP the folder and upload the zip using the file-upload control.
Then on the server end, you can un-zip and read the content.

How to Get complete file path using file upload control in asp.net or any other way?

I want to get complete file path using file upload control. I want to use them to get all the files from that directory.
Thanks.
You can't do this. If you could it would be a huge security hole and a risk to every user everywhere.

Resources