Can I use asp FileUpload to select a folder? - html

I need something like the FileUpload control in asp.net that will allow the user to browse for a folder and enter a file name of a new file to upload.
From what I've seen FileUpload requires a file to be selected. It seems that html input type="file" has the same requirement.
Thanks!

Selecting an entire folder is not possible in FileUploadControl as it is meant for a single file. Although you can have a Multi File Selection. Multiple File Upload User Control

C# has build-in FTPrequest class where you can create folders, upload files, delete files etc.
If you want to upload folders from a webpage, you cannot use this technology in the browser, then you will have to use a rich-client such as Java, Flash or similar plugin.
If you can provide the users with a Windows or Mac client, you can use C# (either .NET or Mono) for the FTP transfer.
ZIP files arent a problem for ASP.net nor C#, but you still only upload 1 file (zip-archive) and then its up to the server to unzip it using eg. C#. Look at 7-Zip which is opensource, then you might get some ideas too.
You could also just try and use the build-in lib for it (compression):
http://www.eggheadcafe.com/community/csharp/2/10050636/how-to-compress-and-decompress-file-in-c.aspx
or try this link...
http://www.aurigma.com/docs/iu7/uploading-folders-in-aspnet.htm

Related

Can you save an image in angular without the backend?

I want to save an image in angular's Assert folder or in a folder created by me. I occupy the input file and a button, nothing more when I save the selected image, I want it to be uploaded or copied to said folders or folder. Can this be done without the backend?
I have been looking for information and watching videos but most of them either use firebase or some other service, I just want it locally. Please, your help would help me a lot.
If I understand your question correctly, you are asking if, at runtime, you can create a file in your Angular applications' 'assets' folder.
This is not possible, because the 'assets' folder is a compile-time artifact. It only exists in your source code tree. In the compiled application, the assets folder does not exist.
Furthermore, when the folder exists, it only does so on the computer on which you wrote the application. The user is running it in their web browser, which is generally running on their computer, not yours.
Now, if you are just asking if you can save a file on the user's computer, take a look at File Save functionality in Angular

Opening certain files in certain folders in a HTML page

I am trying to learn a bit about web technologies therefore I am trying to create a catalogue for my files.
The situation is the following:
I have a folder with N sub folders;
in each of there sub folders there is an image with always the same name (ie: image.jpg)
in each of there sub folders there is also a certain swg file with always the same name (ie: test.swg)
I would like to create an HTML file which read all the sub folders and create a preview using image.jpg, and when one clicks on the preview test.swg should be launched (not in the browser if possible)
The HTML files should contains all these preview like a catalogue.
How can I do this? should I have a local web server which runs in my machine? is it possible to do this with non web page technologies?
Thank you!
As far as i know Javascript & HTML doesn't have access to the filesystem as it's running on your browser and shouldn't be possible to go through the files iteratively because it would be some kind of breach in security.
If you ask me it's possible or not without a server, it should be possible but it is going to use other technology, for example:
Using a Command Line Interface in Linux or Windows based os you could write a shell script that iteratively will go through the files and folder path, and possibly create a JSON from it. From there the javascript could technically load that file like below.
<script type="text/javascript" src="data.json"></script>
<script type="text/javascript" src="javascript.js"></script>
But do note that you should periodically run the shell script periodically with something like scheduler or refresh it manually.
If you want to do it the normal way you could use many different server side language, for example NodeJs, or PHP as I think both of them require only little configuration.
You could post follow up question if you've decided on which language you want to use.
Below is some reference that you can use to start working on reading the directories
NodeJS
Node.js fs.readdir recursive directory search
Get all files recursively in directories NodejS
PHP
List all the files and folders in a Directory with PHP recursive function
How to recursively iterate through files in PHP?
After reading the directories & Files you just need to pass the data to the "rendering" part, and use some javascript to invoke the .swg when the image is clicked
But I'm not really sure about the .swg file can be invoked to the desktop app directly or not you could do some research on it
Open online file with desktop applications?

read and write a text file locally using chromium

I am running a web application from a local folder using Chromium.
Let's say I have my application contained in the following folder:
C:/Myfolder/App
I also know how to read a text file using the HTML5 APIs using a
<input type="file" name="files" id="fileElem" />
now I would like to know if I can read the file without the user having to select the file I am trying to read. The file is always contained in the following folder:
C:/Myfolder/App/Files
a subfolder of the folder containing the HTML that defines my application so there will not be any security restrictions and the file is always run through chromium locally. The file I am trying to read is a text file. Can I also modify and write the file in the same location? If yes would you be so kind to provide some example code?
Thank you very much,
Set TChromium.Options.FileAccessFromFileUrls to STATE_ENABLED and then you can use your normal AJAX functions on file://-Urls.
If you are using jQuery, you could use this code:
$.get('file:///c:/Myfolder/App/files/content.xml',function(data){
console.log(data);
})

Embed HTML + javascript files in Visual Studio Winforms Project

I'm having a hard time trying to integrate some things I thought they would be easy to integrate, but I was wrong.
I have an html file and some javascript files (with no server logic in the html code) and i need to embed them in a Visual Studio winform Project in order to use a WebBrowser control an invoke this html file (which includes the .js files) and I need to have the files inside the client application when I call them.
How can I achieve this?
Thanks in advance!
If everything is in one file, you can embed the file in a ResX container and write
webBrowser.DocumentText = Resources.HtmlSource;
If you have multiple files (eg, images and external .js files), you'll need to copy them to physical files on the end-user's machine to make relative paths work. (or you could put them all into a .mhtml file)

Swing component to open an existing file and then after viewing file save the file

I need a swing component for opening an existing CSV file in notepad or respective available viewer installed on machine and then after viewing give the capability to the user to save the file.
Appreciate your help.
Regards
Paritosh
Offer the user a JFileChooser to select the File then call Desktop.edit(File), is the easiest way to achieve that functionality.
Here it would probably load in Excel or OO.