Upload all files in folder with file upload control

H

i I'm trying to upload all files to a wesite that is in a specific local folder. My code workes fine when I run it locally but when I upload it it fails.

I think it looks for the files to upload on the web server and thus cannot find it.

 

1     Dim files() As String 
2     folderExists = System.IO.Directory.Exists(foldername) 
3     If folderExists = False Then
4         Label1.Text = "Folder does not exist. Did you enter a folder name or just a file name ?"
5         Exit sub
6      End If
7      files = System.IO.Directory.GetFiles(foldername)
8      For Each file In files
9        UploadFile(file.tostring())
10     Next

 

Is there anything I can do to fix this?

-1
Namibian
7/12/2007 2:00:17 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

2 Replies
1073 Views

Similar Articles

[PageSpeed] 34

You are correct in that the webpage looks for the files on the server.

You are mixing up server-side code with client-side code, all pages are executed on the server, and therefore

will look for the files on the server.

You won't be able to accomplish what you are doing using only standard asp.net or javascript.

You'll have to use some custom activex or javaapplet.

 

Regards

Fredr!k

 

-1
Fredrik2000
7/12/2007 2:08:02 PM

Thank you

1
Namibian
7/12/2007 2:35:33 PM
Reply:

Similar Artilces:

Posting filepath in file upload control in .NET to the next page and uploading the file from second page
In our application (using C# .NET) there is a form with file upload options. After filling up the form details, the summary of the details need to be shown in the next page before committing the information into the database. Right now, Server.Control is used to transfer the contents to the next page and the form details are retrieved using Request.Form["control id"]. But this is not working for File upload control alone.File upload can not be done in the first page itself, as the foreign key in File upload table gets updated only in second page after confirmation. Therefore, is th...

How Do I Enable A File Upload Control When Another File Upload Control Has A Value?
Hi There,Thanks you for taking the time to read this post.  I am quite new to programming and have searched the net and experimented with my own code but not been able to get it to work yet.I am creating a simple CMS for a friends site and my friend wants to be able to upload 9 images per page.I have created an asp.net form with 9 file upload controls.  I want 1 control to be enabled by default and the other 8 controls disabled until the previous control has a value.  I have set the default setting in visual studio without any problem.My first thought was to double cli...

Deleting A File Uploaded Through File Upload Control
Hello, I have a form which allows a user to upload a file to a virtual drive on our server using the following code: fileInvoice.SaveAs(ConfigurationManager.AppSettings.Get("DocumentPath") + strFileName); //Document Path is defined in the web.config file How can I safely allow a form on a web page to delete the file if they know the exact name of the file. I don't want them to be able to do a wildcard match like test* thanks in advance, mitch  Peace be on you brother, so you want to safely delete the file which the name you know. OK I consider that the name ...

How to identify the original file type and restrict the file uploading while using file upload control
 Hi asp.net , I am uploading a file using FileUpload control in asp.net using vb.net.I wrote the code to upload only PDF files. the user can change the extension and change to PDF . I have to check is the file original PDF or not then i have to upload the PDF files only . How to do this ??  Hi, Check the file Mime type for "application/pdf" by looking at the:  FileUpload1.PostedFile.ContentType RegardsSmcoxonNo Gem is ever polished without some friction. Hi smcoxon , Thanks For Replying ,But i found that there is no use using PostedFil...

How much size of file can be uploaded with file upload control
How much size of file can be uploaded with file upload control? By default its 4mb but it can be chaged through web config settingsAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved. For a detailed explanation on your query have a look into this article http://msdn2.microsoft.com/en-us/library/e1f13641(vs.71).aspxAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point...

Add link buttons to each file uploaded using File upload control
Hi,   In my application I have one file upload control. When the user selectes a file to upload and when he clicks on Attach button I need to show him the file name of the file he selected to upload and also show the Remove link button after the file name. In this case I need to generate link button dynamically. I wrote a code like the following:protected void btnAttach_ServerClick(object sender, EventArgs e) {string strFileName = MyFile.PostedFile.FileName;string c = System.IO.Path.GetFileName(strFileName); listBoxAttachedFiles.Items.Add(c);LinkButton b = new LinkButton(); b.Te...

Is there any limitation of file types that file upload control can be used to upload?
I am working on a content management system which requires me to upload WebEx recording files (.wrf) through file upload control. But I am getting "internet explorer cannot display the webpage" error. It worked with other files types as txt, doc, xls, pdf, jpg, gif etc. Is it related to any security issue or just a bug with the file upload control?  Thank you. The file upload control doesn't have any file type limitations that I'm aware of, but it does have some size constraints.  By default, ASP.NET is configured to not accept any file's larger than 4...

How to upload an Outlook Message in File Upload control in .Net
Hi All, Is it possible to upload an outlook message from outlook in File Upload control.Please don't suggest to save the message onto the desktop and then upload it!   What I am after is really navigating to the outlook folders through the File Upload control and upload a message.  Thanks guys   If there is a way to do it, but it could be used to maliciously read someone's email folders, forgive me if I hope no one answers you. :)...

File Upload control-Control file size
I am using a file upload tool. I believe the default permissible size for a file uploaded through this tool is around 4 mb. How do I change this limit? I don't want it to be changed for all upload controls on the page. I just want it to be changed for one particular control which uploads music. I want to raise the uploaded file size limit for music to 10MB. hi, here are some information for you to refer to, http://www.vikramlakhotia.com/Dealing_With_the_ASPNet_Upload_File_Size_Problem.aspx http://fileup.softartisans.com/fileup-242.aspx http://www.codeproject.com/useritems/AJAXUpload.as...

file uploader save file on server and in database and upload this file on client
hi,i have a file uploader control user can attach files (.rar, .zip, etc) and store file folder and path in database. and another user can click of attach link and can download that file. how can i do this please solve out this problem. you can find your problem solution in this link and you can store the file name in your database server.http://www.aspnettutorials.com/tutorials/network/net-fileupload-aspnet2-csharp.aspxPlease Mark as Answred If This Blog has Helped You.RegardsMitesh Darjihttp://www.indianic.comhttp://www.mitatdotnet.blogspot.com As always there are many ways and which ...

To increase file size upload option of a html file upload control in 1.1
Hi, whenever i try uploading files greater than 15kb or so, my file control fails. But smaller files are easily uploaded. Please helpIf you keep your feet firmly on the ground, you'll have trouble putting on your pants! Hi, the default maximum upload size of the total form data, so not only your fileupload, is limited to 4Mb. You can increase that number by overriding the default settings in the web.config. Alter the <httpRuntime maxRequestLength="" /> attribute. Dealing with the maximum upload size of ASP.NET. Grz, Kris.Read my blog. Handy Firefox plugins for web ...

how to get author from file when upload using upload control using javascript
function CheckSchemaFileExistence() { var Schemafilename=document.getElementById('<%= this.flUploadB.ClientID %>').value;if(Schemafilename.length>0) {return true; } else { alert("File Name cannot be empty");return false; } }   we written code in button click . i need a file author name . how to find it can any tell me . thanks in advance Hi harish448 For your information, I know you want to get the file's author name, which from client-side But I think Not all type of files have the attribute of "author name" (I think on...

File Upload- Uploads a blank 90kb file
Hi, I'm uploading a 90kb file to both my oracle database and the internet server from asp.net 2.0 via fileupload tag.The file uploads correctly into oracle but uploads with the correct filename but with 0 bytes into my server. Has anyone come across this issue? My Code for saving into my server: Me.filMyFile.SaveAs(Server.MapPath("~/" & "zQ2_" & datever & _ Me.filMyFile.FileName.ToString()))         Please help me solve this issue.Thank YouVic Is the file being created with zero byte?ASP.NET Hosting (HostingFest) Yes, the file uplo...

File Upload
Hey I've got a fileUpload control on an aspx page that works fine for the accepted file type, .rpts, and brings up the correct error message for not allowed extensions such as .exes and .jpgs. But .pdf files should cause an error message to be displayed, as only .rpt files are allowed to be uploaded, but instead it brings up a blank page like a web500 page. Is there a known bug when attempting to upload pdf's?   Just in case,here's the only relevant code attached to the control:   If uploadFilename.EndsWith(".rpt") = True Then 'ensures only .rp...

Web resources about - Upload all files in folder with file upload control - asp.net.getting-started

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Out-of-control car hits Ballajura pedestrians and puts four teens in hospital
Four teenagers were injured in Ballajura on Saturday night when an out-of-control car careered into them.

Is Hillary Clinton sorry she reacted to the San Bernardino massacre with a call for more gun control ...
... "Gun safety" has traditionally meant handling your guns safely, but now it's supposed to mean what has more commonly been called "gun control." ...

more pics from Ground Control Touring 15th anniversary: Woods, Kurt Vile, Parquet Courts, Beach Fossils ...
... Parquet Courts / Woods & Kurt Vile / Beach Fossils @ Webster Hall 12/2/2015 We already posted a review and set of pictures from Ground Control ...

Trump pushes alternative to gun control after attack
Billionaire hits back against New York Times editorial calling for stronger gun control in wake of San Bernardino massacre

EU could soon have border controls
EU ministers have agreed to press ahead with plans to suspend the Schengen passport-free travel zone, the FT reports.

CNN's Smerconish Brings On GOP Ratf*er Karl Rove To Opine Over Partisan Divide On Gun Control
... was time to pray. The New York Daily News ran a controversial cover noting that God wouldn't fix this. Democrats again made calls for gun control. ...

Open thread for night owls: First U.S. birth control clinic lasted just 10 days before being raided
... Parenthood Only Lasted for 10 Days but Started a Revolution . An excerpt: During her time in Europe, Sanger had seen Norwegian birth control ...

Facebook Gives Users More Control Over Viral Content In News Feed
Facebook is updating its algorithm to give users more control over how high viral content appears in their News Feed.

BUSINESS IS BOOMING Firearm buys likely to spike amid gun control push
BUSINESS IS BOOMING Firearm buys likely to spike amid gun control push

Resources last updated: 12/6/2015 3:48:36 PM