File Viewer for all extention for asp.net - asp.net

I have archive website application, this software for archive all document a company. Admin this software upload any extension in this software like AutoCAD, images(png,gif,...), pdf file, etc, I want when user select a file show this file in viewer in browser, But I do not know what tool to use, please help me, thanks all.

Create an image from every file uploaded. Show that to end users.

There is no tool or component that will allow you to show all propriety file formats that exists today.
For every pariticular file format that you wont to support you must have code that understands that format, AFAIK component suite for ASP.NET that have biggest number of supported file formats is Aspose.NET :
http://www.aspose.com/.net/total-component.aspx

Related

How to force Microsoft Edge to download file using correct file extension?

I don't know why, but clicking an anchor link to a .themepack file in Edge causes Edge to change the file extension to ".htm" instead, but only on my site. The .themepack files available on the Microsoft gallery do not behave this way.
Given this, I'm sure it must be a server configuration, but I can't determine how to fix it. At first it was trying to display the .themepack (it's a cab format file) as if it was text, right in the browser. I added the html5 attribute "download" to my <a> tag and that prompted for download, but it still tries to name it as .htm.
Demo of issue:
https://soulcon.com/downloads contains a link to https://soulcon.com/img/SOULCON.themepack
This either tries to show as text, or if you use the page to click the link containing the "download" attribute, it downloads as a .htm file.
Links at https://support.microsoft.com/en-us/help/13768/windows-desktop-themes do not cause this.
Considering this site is on managed wordpress by GoDaddy, I don't have any true direct access to the server.
You need to associate the .themepack file extension with the application/octet-stream MIME type on the server. Ask a support person at your hosting provider how to do that. It may be doable with an .htaccess file.
Worked round the issue by zipping the file.

Wordpress File Upload Hook

I am trying to hook into the Wordpress file uploader and would like some suggestions. I would like to be able to grab the path of the source file (not WP path; i.e. K:\docs\file.pdf) so I can download another file of the same name (different extension) & path automatically (i.e. K:\docs\file.txt).
Wordpress provides hooks for after the file is uploaded but all path information at that point is internal to wordpress.
Thanks in advance!!
the path information can be obtained from normal php functions like pathinfo() and realpath() for example .
Bit too late to the party but I think what you are asking for is to find the source of the document in the clients system and based on that you want similar files there to be picked up by the browser and then sent to the user.
I think it will be a fairly complex thing to do, firstly you have to get the source of the document being added to the browser (I am not sure it can be done, but if it can be done then it will be via javascript) and then upload all the files one by one to the server hosting wordpress and you can do this by creating a custom page which will add the files uploaded to it as a wordpress attachment and then using something like jquery file uploader to upload files to that location.
But honestly, I think it would be a very complex thing, unless the client and the server are on the same machine.

Open File Dialog Asp.Net

I am creating an excel report in vb.net using the office interop. When the report is completed I am saving the excel file on the C drive. The users have asked to save file anywhere they want not just the c drive. Can someone give me some code to popup an opend file dialog in asp.net?
I want the dialog to popup in a saveAs in ASP.NET. I know how to do it in win forms, but I am creating an excel report in asp.net and calling the worksheet objects SaveAs property that excepts a fileName. So right now I just hardcode a file name in there. The users want to choose a file location
I think what you want is actually rather simple.
You can't save a file to the user's computer due to security restrictions (would you want a website saving a file to your computer?)
What you need to do is:
Complete report
Save report file to location on server, IE (.../myWebsite/files/GUID/myReport.rpt)
Display link on next screen pointing to the report file
Doing this the user can right-click and save the file to wherever they want on their computer.
You can clean up these files on whatever schedule you would like.
Assuming you are actually talking about a desktop, winforms app then you can use the built in FileSaveDialog.
Official documentation is here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx
but there are tons of tutorials explaining it out there:
http://www.google.co.uk/search?q=vb.net+savefiledialog
You can server files with the Open / Save dialog by using Response.TransmitFile().
The user is then presented with a save as dialog where they can choose the filename and the location on their computer.
You normally do this inside a HttpHandler. A simple one is described here:
http://blogs.msdn.com/petel/archive/2005/12/01/499189.aspx

ASP.NET File upload - Validation

In our application , we are using asp.net FileUpload control to upload files.
Requirement is , user should be able to upload only ".doc, .xls , .pdf" files.
System should not allow him to upload other files. To achieve this we are validating the extension of the uploaded file. If it is not valid then throwing error message.. this works fine..
But if i change the any exe file as .doc file , then system is allowing to upload. this should not happen.
Is there any way to validate the file with its content instead of its extension ..?
Check out this question/answer on stackoverflow. I belive this is a duplicate question.
Also, look into reading a file's magic number especially if you are just trying to determine if the file is one of a few acceptable types. Magic number Wikipedia
Uploadify is a good file uploading tool that I have found which allows you to specify which extensions you allow the user to see when uploading their files. It also has alot of other cool options and it is highly customizeable. It uses a combination of jquery and flash to allow the user to upload more than one file at a time as well (if desired).

ASP.NET File uploading-dynamic file names

I have a web page where i have an ASP.NET file upload control to upload files from client machine to Server.Now i want to do the uploading n number of times.Ex : I want to upload 100 files from my local pc to server.The 100 file names i can read from an excel file in my program.But is there any way to assign this file to the file upload control ?
No, as a security feature, FilUpload controls do not allow you to set what to download (imagine if you sign on to a website, and it is set to upload a passwords file or something).
Now there is probably another control, or a way to code around this, buut the FileUpload control will not allow it.
I would recommend using the jQuery Multifile Uploader which would take care of a UI (if you need one). And the actual uploads with Free ASP Uploads which takes care of the actual file transfer. Though it sounds like you are tkaing care of the programs programatically, so you can skip the multifule and just work with free asp upload.
You'll have to make your own Flash object or something to accomplish this, the basic HTML/ASP.Net controls won't let you do what you're looking for.
This will require creating some kind of an active or installable control. In order to get around the security hole of doing this, you're ultimately going to have to be able to execute code on the machine to select and upload the file.
And at that point, you're platform specific, so...
I would strongly suggest that instead of trying to have a web site automatically upload files for you, that you make a WinForms utility to accomplish this task and upload the files wherever you need, communicate with the web site over web services, etc.
This is a security restriction, you cant script the file selection of an upload box as it would allow hackers to write scripts to steal files off your computer.
You could use this silverlight upload utility which is my list of "things to use when I get the chance".
It has a nice UI and supports uploading many files at once. I originally tracked it down doing some research for a photography website that we were quoting for but that project fell through.
Anyway the project can be found here:
http://www.michielpost.nl/Silverlight/MultiFileUploader/
It also has full source code included so even if the control's developers abandon it you still have the choice to edit it yourself.

Resources