uploading multiple files from client to server with asp.net - asp.net

uploading multiple files from client to server with asp.net
I have been looking at the asp.net upload control but that is for one file (unless someone knows a better way to do it).
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx
For what I want to do I don't even really need a browse. I know the files off of the client are at a certain location. Is it possible to create a collection of HttpPostedFiles and upload those?
http://msdn.microsoft.com/en-us/library/system.web.httppostedfile.aspx
I don't think it is possible but would be glad to be proven wrong. Is there a different asp.net method or control that will easily allow uploading multiple files from client to server?

Here's a few ideas to look over:
http://www.c-sharpcorner.com/UploadFile/rahul4_saxena/UploadingMultipleFilesInASPDotNET203062009015325AM/UploadingMultipleFilesInASPDotNET2.aspx
http://aspalliance.com/1221_CodeSnip_Uploading_Multiple_Files_At_Once.all
http://www.dotnetcurry.com/ShowArticle.aspx?ID=68&AspxAutoDetectCookieSupport=1

The only multiple file upload component I know from the top of my head is the one Telerik provides:
http://www.telerik.com/products/aspnet-ajax/upload.aspx
That's bundled in RadControls, which is a pretty nice kit to have, though it costs a bit.

Have a look at the System.Net.WebClient.UploadFile and System.Net.WebClient.UploadFileAsync methods.
If you use the synchronous method, you would upload one file at a time sequentially. If you opt for the asynchronous method instead, you could fire off multiple uploads at once.

I Prefer Purifying the stuff with HTML & JavaScript on the Client Side and on the Server Side Using Generic Handler if you are a JavaScript Developer it will be more easier and customizable in your hand and maybe you invent your way of uploading the files
i will tell you about my way of doing this technically
(1st) of course you need to make the upload process without posting the page back and forth to the server so in this case the main item here is an HTML Item which will help us uploading files without posting the whole page which is IFRAME.
(2nd) for most of us in the very beginning we knew the FORM tag is responsible of posting the data from client to server but we didn't know that if we had a INPUT FILE in our FORM we can't post its files to the server without adding a specific attribute in the form tag which is enctype= multipart/form-data
(3rd) there is many techniques invented to make the multiple upload the first one is by adding a attribute to the INPUT FILE which is multiple="multiple" that will make the input file acts to hold a multiple files inside it but in this case it will be a one by one multiple upload when posting the files all together in 1 request to the server.
the other technique is creating in the run time an input file for each file we need to upload with that we can pass the input files control to a form related to each that form of course is inside an IFRAME related to it with that we have a request to each uploading process
to whom ever need more details about that technique free to ask for more description

Related

ASP.NET Core Editable PDF Saving

I am trying to understand the best way to embed a editable PDF inside of a webpage, allow the user to fill out the form then have it post back to the server to save that file on the server.
I have heard about IText, but have not found any great examples of this being done. I understand I could have the user download the file then upload but thought it would be cool to embed it into the page.
Is there an ideal way, or easier way to do this then what I was thinking? I have tried/thought about calling a controller (but really I think I can reference all of this inside of the from on 'OnPost()'.
Could I just an iframe and request the iframes value from the form?

Lightbox2 from photo directory

Is it possible to use the Lightbox2 script to display all photos from a given directory instead of listing each photo in the html?
This is really just a yes or no question, but please feel free to explain. I want to know if this is possible and if I should spend my time trying to figure it out. Thanks for the help.
No, Lightbox2 is written in JavaScript.
When used on a webpage, JavaScript is a client-side scripting language.
This means that the code executes on your web browser, and only has access to data the web browser makes available to it.
For more info: Client-side scripting
You need to use a server-side language (PHP, ASP.NET, etc.) to work with the server-side directories.
Here is an answer to a similar question, with a suggestion to create an index file w/ all the image file names that you could then parse with JavaScript. I don't think it would be much more efficient than manually adding img elements though.
Is there a way to return a list of all the image file names from a folder using only Javascript?

Alfresco Share | Using dashlet into a custom page programmatically

I'm very new to Alfresco. My question is, how can we use a dashlet (created from scratch) into a page (created from scratch too)? What are the files and configurations to deal with, for including a dashlet into a page.
Moreover, the newly created page has to be similar to dashboard page but without authentication. The idea here is to do away from the default "Share" dashboard login flow.
Thanks.
A dashlet is simply a special type of web script, so yes, it is quite possible to place the same web script into a custom page by binding it into a component region.
The relationship between pages, templates, components and regions can be a little complex if you're new to Share development, so I'd recommend reviewing Dave Draper and Erik Winlof's Share Customizations Live presentation from last November's DevCon, where they introduce a sample project including an Ant build script and which includes a custom web script and page definition. The code can be downloaded from this Git repo as a basis for your own project.
You should not find that too many changes if any are required to your dashlet web script to make it work inside a custom page, but remember that if the user is unauthenticated then you will not have access to any information about them, nor will you be able to retrieve any data from the repository.
Let me try to answer this with some examples:
Alfresco page
To create an Alfresco Share page (you use share?), you need to create three files:
<TOMCAT>/webapps/share/WEB-INF/classes/alfresco/site-data/pages/my-page.xml
<TOMCAT>/webapps/share/WEB-INF/classes/alfresco/site-data/template-instances/my-page.xml
<TOMCAT>/webapps/share/WEB-INF/classes/alfresco/templates/org/alfresco/my-page.ftl
The first one defines your page, the second one defines what components (dashlets) you will use on the page, and the last one is a HTML template (in Freemarker) arranging your components.
The first two files are XML, a bit alfresco specific, but simple XML, and the last one you could put static HTML and it'd work, or you could put some freemarker macros.
What is in each of those files (examples), you can read on this page, written specially for you and this question :) (Don't ask, I felt like writing about it)
No authentication
To not use authentication, you can just put <authentication>none</authentication> in the page definition file (the first XML file).
Dashlet files
Basically, a dashlet can be at the minimum two files, usually 4-5 or something like that. The dashlet.get.desc.xml file signifies two things: desc.xml part says it's for a new component (dashlet), and get part says this component will answer to HTTP GET calls.
is usually placed somewhere bellow /webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components. Doesn't really matter where bellow, but you would want to put it in some folder to manage all your code easier.
This file contains one important thing: url. Url defines what url your dashlet will answer to. And when you defined your page in the page definition above, you would put this url there to access the dashlet.
You could even access the dashlet directly, using the link http://localhost:8080/share/my/url/to/dashlet.
The other file, dashlet.get.html.ftl is, again, a freemarker template file. You put HTML there. You can also have a controller file for the dashlet, dashlet.get.js which prepares some dynamic content (it is written in server-side javascript and has access to some of Alfresco Javascript API).
Finally, you can put some internationalized text (translations) into bundles (basically, dashlet.get.properties, dashlet.get_DE.properties, dashlet.get_ES.properties etc, by browser lanugages).
There are also options to include client-side javascript or css files to this dashlet.
To see how exactly to assemble all this, you could try reading this page. Probably not really a good read, but it will hopefully clear some things up.
Sorry, just to be clear, you want to reproduce a share interface on an Alfresco repository, but without the login? Dashlets and interface components are webscripts, and webscripts are stored inside the repository, so in order to access them you need to be authenticated. You could use tag in the webscript xml description a runas="admin" or runas="guest" in order to achieve something. If i misunderstood, please let me know, and I'll try to help..

ASP.NET, combining conditionally included script files

We are working on an ASP.NET CMS project using jQuery as the basis for our client side scripting.
The jquery-1.2.6.js file is the only script file that is always included. Other script files are currently included depending on what components the CMS editor is using on a page or page template.
A lot of the script combiners produce a static script. If we took that approach we would have to add all possible script files in just in case they were needed. We are not currently using any of the ASP.NET Ajax extensions so have not looked at what that may give us.
Anyone got any suggestions?
I have read Combining and Caching multiple JavaScript files in ASP.net but I don't think that covers off the conditional nature of our situation
So great I can use ScriptManagerProxies and some methods on the base master Page. However there is one other thing. Stopping all the ASP.NEt Ajax guff being sent down to the client. I am going to take a look at bleroy's hack until ASP.NEt 4.0 releases
TIA
Pat Long
Working in Sitecore on a site that had multiple scripts for different pages, we created a list of script items in Sitecore, then added a Multlilist field to the Items. We had a placeholder in the head of the master page, and dynamically added the scripts as they appeared in the multilist field. We did the same thing with CSS as well. It worked out nicely. (Specifically, it was on http://www.utulsa.edu)
Edit: I misunderstood what you originally meant. It seems like you may need combine and produce all the possible static scripts you need, then dynamically include the one you are looking for, if you're looking for only one script include per page.
Otherwise, you could just depend on caching to keep your script requests down, and do what you are currently doing
Edit 2: A third thought is you could write your own combiner that will combine scripts on demand, and include the generated (or pre-generated) script
I don't know if this will help you or not, but Scott Hanselman posted on twitter that you could download issues of MSDN Magazine for free. I followed the link and looked through a couple of issues and this month (Feb, 2010), and one of the first articles discusses predictive fetching with jQuery and ASP.NET Ajax.
This looks like it could be along the lines of what you're looking for. As far as stopping the AJAX requests, I haven't read the entire article, but I'd assume it mentions something in there (as predictive fetch would have to account for this).

Upload an entire folder's files with jquery.MultiFile.js instead of having to select each file individually

I have jquery multi-file working as shown in link text. However, what I really need is to be able to select a folder, then every file contained in the selected folder to be listed, at which the user could then remove any unwanted files before hitting 'upload.'
Has anyone done this with jquery multi-file upload? Would it be difficult to modify multi-file.js to make it do this? Are there any other open-source possibilities? I would love to use the ASP.NET FileUpload control without any javascript but it seems rather limited [I have virtually no javascript knowledge...yet].
Any insights, tips or suggestions would be greatly appreciated!
This widget still uses HTML's <input type=file> capabilities that is extremely simple and non-customizable. That's why you won't be able to change existing script to be able of selecting multiple files inside Open File dialog.
For selecting multiple files at once you're going to have to use Flash. The good news is, they normally come with upload progress bar as well.
Try Uploadify plugin script instead.

Resources