using ASP.net, vs2008 C#.
Im using a FileUpload control on a webform. The uploading of a file (ie PDF dcouments) to a server directory works ok.
I have on the webform a "preview" button that the user can use to preview the PDF file after they have selected it via the Fileupload browse feature.
I do this by
if (this.FileUpload1.HasFile)
{
localURL = FileUpload1.PostedFile.FileName;
// use this to preview file. Other methods are restricted by local security requirements
Process.Start(localURL);
}
My problems is that after the button click Postback occurs the location of the selected file disappears from the textbox part of the Fileupload control.
How can i keep this info there, so the user does not have to browse again and instead can just click upload to upload the file.
Any help appreciated
thanks
try putting the localURL variable into a session. worked for me once
Related
I wast to use an image as a Fileupload control asp.net application such that when I click on the image, it opens file explorer. Once an image is selected, the the selected image is displayed. I should also be able to store the selected image into a database. Any code to do that?
Please be specific to the point what you have done so far. But I give you link for the solution.
File Upload control to upload file and save record in database
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
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.
Hey friends, I need to open an swf file without storing it in a temporary location using AJAX Document Viewer. However, it should open on click of an image button and in the same page. How can I do this?
Is there a way to upload an image using flex inbuild .browse() and classic asp?
So in flex the user picks the image they want to upload, press a button to start sending it. A asp handler then gets the file, uploads it to a folder and then writes the filename in a database.
Writing of the filename in the database is no problem.
I believe it is but you have to have an ASP component such as ASPUpload on the server to allow it.