.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

Uploading files from one site to another.

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

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


View Complete Post

More Related Resource Links

uploading a photo into my site



I am working on my company's intranet which runs on sharepoint. Right now, very few people have uploaded their pics into their MYSITE. I know this can be done by logging in into the SSP, but I need a HR representative to upload the photo and they should not have access to the SharePoint server.

Are there any free web parts that I can install, that will give the HR rep to upload the photo..and then..it will automatically appear in the staff's MYSITE

Can't open site in Designer/ Can't open files in Designer

I'm having trouble in Designer 2007.  I can not open any sites files on sites on our prodution server.  I get "Couldn't open file ..........aspx".  On our development server I can't even open sites.  I get "Invalid folder name".  Can anyone please advise?  I have seen other posts about this behavior, but none of the solutions have worked for me.  I've uninstalled Expression Web, I don't have Front Page installed, and I ran a repair installation on Designer.  Still no luck.  Any ideas please?

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

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

Problem Saving Files to A Sharepoint 2010 Site from Office 2010: Saves locally by default rather tha

Hi we are starting to use sharepoint 2010 / word 2010 and have found an interesting bug/problem. Sometimes when a user tries to save a file (by clicking on the save button in the quick access toolbar for word 2010) the save dialog comes up with the users local "Documents" folder as the path (not the correct sharepoint path where the document should be saved).  (I should say that we are creating the file from sharepoint by using a toolbar on the document library, with the new button)  We are using a content type and a template attached to the document library when we create the file.  This is really annoying because the user might not notice that the document is saving locally and not to sharepoint.  I have found a strange workaround which involves clicking the [File] tab on the ribbon in word 2010, then clicking "Save and Send" and then clicking the save button again.  At this point word 2010 seems to "remember" that it is trying to save document to sharepoint and shows the sharepoint document library. This is a real nuisance which could lead to documents being lost/misfiled if people don't realize that this is happening.  Can anyone help me? Thanks Kevin krd

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

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!

wss2.0 and opening office 2007 files directly from site


When opening a office 2007 file directly from a wss2.0 link, eg. http://sharepointsite/document.docx, I am prompted with the 'Open|Save|Cancel' dialog.

On selecting Open, the file does not open (as it does for an office 2003 file) but prompts me to Save the file.

When opening the file from the document library, it opens directly, just not through a direct link to the file.

Any solutions on how to open the file directly?


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....


Copy folder from FTP site using SSH to local machine using DOS batch files



Is there a way to copy a folder from an FTP site listening on SSH connection using DOS batch files? I know that there are several third party tools out there that accomplish this. I am NOT looking for that solution. I tried this in Powershell, but could not find a solution, and I am hoping a simple DOS batch file can handle this.


Any help would be appreciated...

Dave SQL Developer

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.

Error: There are no page layout files available in the master page library of the top-level site.

I exported one of the subsite using stsadm and imported into a new site collection, I could access the new site collection but whenever I try to create a new page in my new site collection I get the following error.

There are no page layout files available in the master page library of the top-level site. Add one or more page layouts to this library before you create a page or set page properties.

Please help. Thanks.

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 number of files after uploading


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

Uploading Files with Info Path Form




we'd like to provide an Info Path Forms Services based form to give users an easy web based ability to upload new documents with some metada and doeing some plausability tests to check if the metadata do make sense. The form will be presented to external users to provide documents in a structured and qualified way.


So we created the InfoPath form and added a repeating "File-Attachment" control to the form. But with this control the files are attached to the InfoPath form itself and not uploaded to a document library. And so the internal users can not easyly work with the documents.


So what would options do we have to customize InfoPath to provide an possiblility to upload documents to a document library?




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