473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Uploading entire directory

I know how to upload an individual file to a server (See below code
snippet).

QUESTION: Is there an easy way to upload an entire subdirectory and all
it's files? Or, do I have to loop thru the dir and upload them 1 by 1?

This is the way I'm uploading the file...

Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName) ' only the
attched file name not its path

' Let us Save uploaded file to server
Try
MyFile.PostedFile.SaveAs(ConfigurationSettings.App Settings("NewsletterFileDir")
+ c)
Span1.InnerHtml = "Your File Uploaded Sucessfully: " &
ConfigurationSettings.AppSettings("NewsletterFileD ir") & c
Catch Exp As Exception
Span1.InnerHtml = "An Error occured. Please check the attached
file"
End Try
Nov 19 '05 #1
4 1219
The entire Directory!!!!
Can't u let it create a directory before uploading files or just ove files?
"VB Programmer" wrote:
I know how to upload an individual file to a server (See below code
snippet).

QUESTION: Is there an easy way to upload an entire subdirectory and all
it's files? Or, do I have to loop thru the dir and upload them 1 by 1?

This is the way I'm uploading the file...

Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName) ' only the
attched file name not its path

' Let us Save uploaded file to server
Try
MyFile.PostedFile.SaveAs(ConfigurationSettings.App Settings("NewsletterFileDir")
+ c)
Span1.InnerHtml = "Your File Uploaded Sucessfully: " &
ConfigurationSettings.AppSettings("NewsletterFileD ir") & c
Catch Exp As Exception
Span1.InnerHtml = "An Error occured. Please check the attached
file"
End Try

Nov 19 '05 #2
The standard File control allows only one file to be specified for upload.
If you need to upload 2 files, then the simplest solution is to have 2 File
controls on the page.
There are fancier options, but they generally require thick clients. Here
are some 3rd party options that may help you out:
http://fileup.softartisans.com/fileup-231.aspx
http://fileup.softartisans.com/fileup-131.aspx

More info:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"VB Programmer" <xD**********@Dont.com> wrote in message
news:uO**************@TK2MSFTNGP14.phx.gbl...
I know how to upload an individual file to a server (See below code
snippet).

QUESTION: Is there an easy way to upload an entire subdirectory and all
it's files? Or, do I have to loop thru the dir and upload them 1 by 1?

This is the way I'm uploading the file...

Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName) ' only
the attched file name not its path

' Let us Save uploaded file to server
Try

MyFile.PostedFile.SaveAs(ConfigurationSettings.App Settings("NewsletterFileDir")
+ c)
Span1.InnerHtml = "Your File Uploaded Sucessfully: " &
ConfigurationSettings.AppSettings("NewsletterFileD ir") & c
Catch Exp As Exception
Span1.InnerHtml = "An Error occured. Please check the attached
file"
End Try

Nov 19 '05 #3
Orr for President. Thanks.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
The standard File control allows only one file to be specified for upload.
If you need to upload 2 files, then the simplest solution is to have 2
File controls on the page.
There are fancier options, but they generally require thick clients. Here
are some 3rd party options that may help you out:
http://fileup.softartisans.com/fileup-231.aspx
http://fileup.softartisans.com/fileup-131.aspx

More info:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"VB Programmer" <xD**********@Dont.com> wrote in message
news:uO**************@TK2MSFTNGP14.phx.gbl...
I know how to upload an individual file to a server (See below code
snippet).

QUESTION: Is there an easy way to upload an entire subdirectory and all
it's files? Or, do I have to loop thru the dir and upload them 1 by 1?

This is the way I'm uploading the file...

Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName) ' only
the attched file name not its path

' Let us Save uploaded file to server
Try

MyFile.PostedFile.SaveAs(ConfigurationSettings.App Settings("NewsletterFileDir")
+ c)
Span1.InnerHtml = "Your File Uploaded Sucessfully: " &
ConfigurationSettings.AppSettings("NewsletterFileD ir") & c
Catch Exp As Exception
Span1.InnerHtml = "An Error occured. Please check the attached
file"
End Try


Nov 19 '05 #4
Within a FORM tag you can specify several INPUT tags of type=FILE to upload
several files but the user must select each of the files to upload.

Yes HTML specifications has limitations (for good reasons) but if you really
need to go outside of the HTML specification write a Windows Application not
a Web Based Application..
Don't compromise security. Every developer has good intentions but hackers
don't. Think like a hacker to write better secured web applications or to
decided whether a Web Based application is what you should be developing.
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
The standard File control allows only one file to be specified for upload.
If you need to upload 2 files, then the simplest solution is to have 2
File controls on the page.
There are fancier options, but they generally require thick clients. Here
are some 3rd party options that may help you out:
http://fileup.softartisans.com/fileup-231.aspx
http://fileup.softartisans.com/fileup-131.aspx

More info:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"VB Programmer" <xD**********@Dont.com> wrote in message
news:uO**************@TK2MSFTNGP14.phx.gbl...
I know how to upload an individual file to a server (See below code
snippet).

QUESTION: Is there an easy way to upload an entire subdirectory and all
it's files? Or, do I have to loop thru the dir and upload them 1 by 1?

This is the way I'm uploading the file...

Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName) ' only
the attched file name not its path

' Let us Save uploaded file to server
Try

MyFile.PostedFile.SaveAs(ConfigurationSettings.App Settings("NewsletterFileDir")
+ c)
Span1.InnerHtml = "Your File Uploaded Sucessfully: " &
ConfigurationSettings.AppSettings("NewsletterFileD ir") & c
Catch Exp As Exception
Span1.InnerHtml = "An Error occured. Please check the attached
file"
End Try


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
1
by: Andrew M. | last post by:
Is it possible to upload entire directories from a form in such a way that a user can browse to the folder on their local machine and select it for uploading or synchronization? I am using php5.
9
by: R. Rajesh Jeba Anbiah | last post by:
Q: How should I handle file upload? A: File uploading requires HTML form of content type "multipart/form-data". The file content has to be POSTed/submitted via the form and once the file is...
1
by: Jim Mitchell | last post by:
I have a rather simple project with several ASPX files. If I make a change to one of the files, can someone tell me the least I need to do to update my project on the server. Right now I am...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
3
by: Kamen TOMOV | last post by:
Hi, Is uploading recursively directories to a web server possible with JavaScript? I mean is it possible read a directory recursively and dynamically construct <input type="file"> with value...
5
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or...
4
by: Mukesh | last post by:
Hi all I am trying to upload and save as a picture to "root/Photos" folder in my web application. I am using this code to perform this task DirectoryInfo strFolder = new...
8
by: pinkfloydhomer | last post by:
The place where I host my website gives me 7GB space total to use. Normally, I also use this space to save files that I need to access from several locations. The only way of uploading files is by...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.