PDA

View Full Version : [CLOSED] does FileUploadField support multi file upload?



hdsoso
Oct 04, 2013, 3:38 AM
i am using ext.net from svn which version is 2.2.0.29692.
dose FileUploadField support multi file upload?
need update ext.net version ?

Daniil
Oct 04, 2013, 5:27 AM
Hi @hdsoso,

No, it doesn't.

There is a MultiUpload control in the trunk. It is based on Flash. The examples you can find in the trunk's Examples Explorer, in the MultiUpload folder.

hdsoso
Oct 04, 2013, 12:45 PM
Hi @hdsoso,

No, it doesn't.

There is a MultiUpload control in the trunk. It is based on Flash. The examples you can find in the trunk's Examples Explorer, in the MultiUpload folder.

i update the svn and can not find example code of uploading files to servers , could you please give me an example?


<ext:FieldContainer runat="server" LabelWidth="65" Margin="4" FieldLabel="上传图片">
<Items>
<ext:MultiUpload runat="server" ID="mu_1" OnFileUpload="MultiUpload1_FileUpload"
AutoStartUpload="true"
FileDropAnywhere="true"
FileSizeLimit="15 MB"
FileTypes="*.*"
FileTypesDescription="All Files"
FileUploadLimit="100"
FileQueueLimit="0">
<Listeners>
<UploadStart Handler="Ext.Msg.wait('上传中');" />

<UploadComplete Handler="Ext.Msg.hide();" />
</Listeners>
</ext:MultiUpload>
</Items>
</ext:FieldContainer>



protected void MultiUpload1_FileUpload(object sender, FileUploadEventArgs e)
{

var fname = this.mu_1.FilePostName;
var flength = this.mu_1.FileQueueLimit;

var ran = new Random();
string sNewName = DateTime.Now.ToString(@"yyyy-MM-dd-HH-mm-ss") + ran.Next(100, 999)
+ Path.GetExtension(fname);
var y = System.DateTime.Now.Year.ToString(CultureInfo.Inva riantCulture);
var m = System.DateTime.Now.Month.ToString(CultureInfo.Inv ariantCulture);
string strPath = HttpContext.Current.Server.MapPath("/Uploads/" + y + "/" + m + "/" + sNewName);
string pathMoth = HttpContext.Current.Server.MapPath("/Uploads/" + y + "/" + m);
string webPath = "/Uploads/" + y + "/" + m + "/" + sNewName;
if (!Directory.Exists(pathMoth))
{
Directory.CreateDirectory(pathMoth);
}
// this.mu_1..PostedFile.SaveAs(strPath);
// here how to save the file to the server???
var img = "<img src='" + webPath + "'/>";
he_cont.SetValue(he_cont.Text + img);


}

Daniil
Oct 04, 2013, 2:07 PM
An example is here:

http://svn.ext.net/premium/trunk/Ext.Net.Examples/Examples/MultiUpload/Basic/Simple/Default.aspx

hdsoso
Oct 04, 2013, 2:24 PM
An example is here:

http://svn.ext.net/premium/trunk/Ext.Net.Examples/Examples/MultiUpload/Basic/Simple/Default.aspx



protected void MultiUpload1_FileUpload(object sender, FileUploadEventArgs e)
{
System.Threading.Thread.Sleep(3000); // for testing purposing only
X.Msg.Notify("File is uploaded", "Name: " + e.FileName).Show();
}

there is no upload file code.

Baidaly
Oct 04, 2013, 5:51 PM
Hello!

Selected files are submitted one by one and each file upload calls MultiUpload1_FileUpload method. All information about currently uploading file is in FileUploadEventArgs.


protected void MultiUpload1_FileUpload(object sender, FileUploadEventArgs e)
{
HttpPostedFile file = e.PostedFile;
System.Threading.Thread.Sleep(3000); // for testing purposing only
X.Msg.Notify("File is uploaded", "Name: " + e.FileName).Show();
}