.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

count number of files after uploading

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :ASP.Net

Hello, im hope i can make sense to this post cause i dont have an idea where to begin :-) I have some files upload code so the user can upload files to the server (it can be 1 or 5 or 20 files). the code is working fine, and the files uploading to the folder on the server. The problem is, that after the files uploads i need to display to the user some textboxes to every file (like: number of copies, if its color or b/w, the print size etc). is there some way, after the files is uploaded, to show the user the name of the files and for each file name to display some textboxes (like: to count the number of files and then display the names and few same textboxes for each file), thanks

View Complete Post

More Related Resource Links

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Uploading files from one site to another.


I need to upload files from one site to another and I thought about using the WebClient class and FileUpload method from the System.Net namespace. I read the MSDN documentation and it seems an easy task to achieve but something is going on wrong. For now, I am only testing with the following simple code to upload a file to a test web server in our office which uses HTTP port 8080 instead of 80:

Protected Sub btnSubeFotosChicas_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubeFotosChicas.Click Dim objWebClient As WebClient = New WebClient() objWebClient.UploadFile("", "d:\temp\getmap.jpg") End Sub

The code above issues the following exception:
"The remote server returned an error: (404) No Found."
I have made sure that both paths are correct.

Also, does the UploadFile method saves the file physically in the hard disk (I suppose so) or does it load it into the server's memory?

I have read several posts here and there but I am getting more confused so I will very much appreciate your kind advice as detailed as possible.

Jorge Maldonado


Uploading files

Hello, I'm working on a small project where users will need to add records and sometimes include attachments that relate to that specific record. i.e input details around a company issue and be able to upload supporting documents or pdfs.  I'm guessing I would use the fileupload to do this however I'm unsure how to do so and how do I make that attachment relate to that record keeping in mind the attachments could be called anything and the users will need to be able to download the attachment when viewing that record. I've been googling the last couple of nights but not really finding what I need. If someone could please post some sample code that would be great, keeping in mind I'm still very much a novice. Thanks in advance. Mark

Cannot count number of checked items using jQuery

Hello,Using Microsoft built-in jquery files, when counting numbers of checked checkbox, the jquery-1.4.2.min.js cannot count the correct result ,however, the version jquery-1.3.2.min.js gives out the correct one, why?            $("#check").click(function () {                var nameSports = new Array();                var i = 0;                $('input[name=selector]:checked').each(function () {                    nameSports[i] = jQuery(this).val();                    i += 1;                });                if (loopCounter != 0) {                    alert(i);                }  

What is the best Hosting model when Uploading Large Files via WCF?

I am building a WCF service where besides regular CRUD operations, it porovides methods to upload large (upto 15MB each) files. The service will serve a number of "clients" that will send data to our back-end. Now, while some of the clients are ok with sending one file at time, others would like to be sending these files in batches (i.e. several files at a time).... My questions: What is the best option for hosting this service considering the environment (see below)?  Will IIS be able to support it or will it time out? I know you can increase timeout limit in config file but how will it handle a batch of large files at a time? Is windows service a better option here? What are the dis/advantages of IIS vs Win Srvc in this scenario?  Current Environment: Win 2003 Server w/IIS 6.0 and WCF (.NET 3.5) Thanks in advance!

Restriction in uploading the files

Hi, There is Attach file link on the Newform.aspx of list to upload the files.As a part of client requirement user should be able to upload the files only from Picture Library.So in the pop up i need to display the Picture library and the corresponding files in it.Could you share your thoughts regarding this? Thanks & Regards, Sudheer

Count of number of times the document is downloaded from document library

Hi All, I am working on sharepoint 2007.  My requirement is: I need to take the count of number of times the document is downloaded from document library. I used log report which doesn't solved my purpose. Any Idea how can we acheive this ?   Regards

Document Set - Problem when uploading multiple files with "Launch forms in a dialog" disabled

Hello, Has anyone come across this before? I have a basic document library for which I have enabled "Allow management of content types" and disabled "Launch forms in a dialog".  Both of these settings are in the "Advanced Settings" page.  Also, the document library does not have versioning enabled and check out is not required. I added the OOTB "Document Set" content type to this document library and allowed OOTB "Document" content type documents in this document set.  This document set does not have any default content. The issue arises after I upload multiple files and click the "Done" button.  After I do this, the browser redirects to the top level of the site!  For example, if I uploaded to my document set at http://server/sites/anyname/doclib, I am redirected to http://server/. This issue has come up in both a standard server and an enterprise server. Steps to repeat issue: Create a document set Open the document set Select "Upload Multiple Documents" Drag and drop or browse for files Click "OK" Click "Done" Actually, this issue also occurs when "Launch forms in a dialog" is enabled.  In this case, you just have to navigate to the upload form directly (with all the necessary query string parameters, of course). Has anyone else seen this issu

Uploading files produces older versiones

Hi,   I have a sharepoint document library in which i have no versionin enabled. This is my use case: 1) 10/2/2010 i upload a document called test.doc 2) 11/2/2010 i upload a modified document called test.doc 3) the contents in the file are those of 10/2/2010 4) mmm ok. I'll delete the file, emptied my trash bin. and try to upload test.doc (11/2/2010) again 5) the contents in the file are those of 10/2/2010!!!!!!!!!   I'm sure is not some local cache because i try uploading it from different machines and also open it from different machines. Same results. Why is this happening? the only workaroud is to change the name of the file: test1.doc, test2.doc. So, basically i have my versioning system for Sharepoint. It is really getting on my nerves.   Any help will be highly appreciated.   Thanks, Luis

How to count number of characters in a textbox?

On my current form I have it validating a Canadian Postal Address (xxx xxx). The space is optional but if the user does not use a space, then once the validation passes it will insert one. How can I count the first 3 characters of the textbox, insert a space, then add the rest of the characters?Thank you

AsyncFileUpload- Uploading multiple files, individually.


Hi guys,

I've done some searching, but am unable to find what I'm after.

I'm using the asyncfileupload control, and have it woking to an extent. I'm able to upload the image to the relevant directory and save it's path to the database.

The problem I'm having is that I am unable to upload a 2nd file once the first has completed without refreshing the page.

Any ideas?

Thanks in advance!

Count of files not coming correctly.



I have a folder, which contains sub folders. For example: Doc is the root folder. Inside it has 2 sub folders named Doc1 and Doc2.

Doc1 contains 2 sub folders - fol1 and fol2.

"fol2" folder does not contain any files, where as foc1 has a file in it. I am trying to get the count of files modified in last 30 days. Against each of the sub folders i want to show the count of modified items. Though "fol2" folder does not contain any files, I am getting the count as 1. "fol1" folder is also showing count as 1, as it has file modified in last 30 days. 

I am missing a small part of updation, but not sure where it is. This is the code i have used:

 static int CountFilesInFolder(SPFolder folder, DateTime startDate)
 int count = 0;
if (folder != null && folder.Name.CompareTo("Forms") != 0)
 if (folder.SubFolders != null)
 if (folder.SubFolders.Count != 0)
 foreach (SPFolder item in folder.SubFolders)
 count += CountFilesInFolder(item, startDate);
 item.Item["Files_Count"] = count;

foreach (SPFile item in folder.Files)
    if (item.TimeLastModified >= startDate)
  return count;


Thank you

Number of Log Files

From a best practices perspective, how many log files (.ldf) should a database be configured for?  I have read conflicting accounts that say one to 'n'.

Uploading multiple files in ASP NET 1.1


Hi, not sure if anyone can help me I have been searching the net for two days trying to find the answer to something I am struggling with but with no luck. I am trying to make a web application which copies the existing functionality of a windows forms application using Visual Studio 2003.  This windows application takes multiple (I am talking at least 30) text files and joins them together into one text file which can then be feed into a Mainframe system in the correct format. I have written web applications before that uploads images and pdfs but the key thing is it was always only one or two files at a time, so this was easy to do with the HTML fileupload control. What I want to do is to be able to open a directory on the local computer and either automatically, or give the user the chance to multi select (I dont think this is possible) all of the 30 or so files they wish to upload. Once its been uploaded I can do the processing to join the files and create my new one etc.  All the examples I have seen on the web, you have to select the files one by one to add to a list box and then they can all be uploaded but this wont be acceptable to my users... Any ideas on how to do this or even a its just not possible with ASP.NET would be good. Thanks....


how to prevent session timeout during files uploading (postBack free uploader).


Hi All,
         i am using a multi selecting file upload control which is postBack free.
I am using session timeout.
 My problem is that during files uploading my session got expired. Bcoz my uploader
not being postback so i can't enhance session timeout. and while uploading my session
got expired and process was not completed, causes some imp files could not uploaded.

 any one suggest me what to do OR any idea to complete uploading then session timeout.

Reg. uploading files to ftp server


Hi Guys,

I'm trying to push the contents of a folder(files & sub-directories) to an ftp server. Can I get a nice sample?


Count the number of users per web page


Hello everyone,

I have a website that has 10 aspx pages in it, and I'm trying to count how many users are on any one page at a time, and display that number on the web page.  I have set it up to use an Application object ("TotalViewers"), and initialize it to 0 in the Application_Start event handler of the global.asax file.  My reasoning (probably way off base) is to increment the count on each page load, and then decrement the count on each page unload.  The increment part works ok, but when I add the code in the page unload event handler to decrement, it seems that Unload happens before the Page is presented to the client, so the  value always stays the same (adds one in page load, subtracts one in page unload).

How else  can I track number of users on each page?  (simply, becuase I am still a beginner).  I have already done some google searching and haven't come up with anything useful. 

All my pages are being navigated via a TreeView control.

Thank you,





ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend