uploading multiple file in a folder

  • Thread starter Thread starter karnati
  • Start date Start date
K

karnati

hi group,

i need to upload all jpg images located in a folder is it possible
using file option

thanks in advance

karnati
 
No. You either need to provide multiple input file fields, or have the user
zip it up, send you the zip and unzip it.

This is an HTML limitation.

Karl
 
hi karl,

thanks for ur reply
i am trying to upload contents of a full folder using

private const string SERVER_FOLDER = @"C:\ServerFolder\";

private void Button1_Click(object sender, System.EventArgs e)
{
ArrayList fileList = new ArrayList();
string dirNameWithPath =
System.IO.Path.GetDirectoryName(File1.PostedFile.FileName);
// Get the files in the Directory
string[] files = Directory.GetFiles(dirNameWithPath);
foreach(string str in files)
{
// Add into the ArrayList
fileList.Add(System.IO.Path.GetFileName(str));
}
// Bind to the ListBox
ListBox1.DataSource = fileList;
ListBox1.DataBind();
// Run a loop and upload the files
foreach(string str in fileList)
{
File1.PostedFile.SaveAs(SERVER_FOLDER+System.IO.Path.GetFileName(str));
}
}

in my native system it is working fine but when i setup and try to
upload it is not returning the directorypath name

so please help me with that


thanks in advance
karnati
 
Your code doesn't make any sense to me. You are getting all the files in a
folder on the server, and then using the fileUpload control to save the same
file over and over again?

if c:\serverfolder\ contains:

sample.txt
song.mp3
test.ini


and the user uploads "Friend.Jpg", your code will save "Friend.Jpg" as
"sample.txt", "song.mp3" and "test.ini" which I can't imagine why you'd
want to do that..

Karl

--
http://www.openmymind.net/



karnati said:
hi karl,

thanks for ur reply
i am trying to upload contents of a full folder using

private const string SERVER_FOLDER = @"C:\ServerFolder\";

private void Button1_Click(object sender, System.EventArgs e)
{
ArrayList fileList = new ArrayList();
string dirNameWithPath =
System.IO.Path.GetDirectoryName(File1.PostedFile.FileName);
// Get the files in the Directory
string[] files = Directory.GetFiles(dirNameWithPath);
foreach(string str in files)
{
// Add into the ArrayList
fileList.Add(System.IO.Path.GetFileName(str));
}
// Bind to the ListBox
ListBox1.DataSource = fileList;
ListBox1.DataBind();
// Run a loop and upload the files
foreach(string str in fileList)
{
File1.PostedFile.SaveAs(SERVER_FOLDER+System.IO.Path.GetFileName(str));
}
}

in my native system it is working fine but when i setup and try to
upload it is not returning the directorypath name

so please help me with that


thanks in advance
karnati



No. You either need to provide multiple input file fields, or have the
user
zip it up, send you the zip and unzip it.

This is an HTML limitation.

Karl

--
http://www.openmymind.net/
 
hi karl

thanks for that reply, i got one more problem

is it possible to access the .mdb file from client system

i.e when client says browse and selects the mdb file the data in it
should be accessd

is it possible


have a nice day

karnati
 
Sure, you'll need to store the file on the server and open it though - just
like you would any other mdb file sitting on the server.

Karl
 
Karl Seguin [MVP] wrote:
Sure, you'll need to store the file on the server and open it though -
just like you would any other mdb file sitting on the server.

Karl

hi karl
thanks for that reply
but my requirement is without uploading to website direct access from
client system
is it possible
have a nice day
karnati
 
No. You can't connect to an access database remotely -the Jet engine simply
doesn't support that.

Karl
 
Back
Top