PDA

View Full Version : [CLOSED] how can i upload multiple files using Ext.NET + IE



JCarlosF
Jun 20, 2013, 7:19 PM
Hi,

I need to implement a multiple file upload in my app, i read in the forum that this is not possible with ext.net component and IE < 10 exists another way to do that ? is possible use SWFUpload with Ext.NET ? any suggestions

thanks

Vladimir
Jun 20, 2013, 7:35 PM
SWFUpload distributive has ASP.NET example which you can use in your Ext.Net application
https://code.google.com/p/swfupload/

michaeld
Jun 21, 2013, 1:45 AM
Is SwfUpload being considered to be part of a future version of ext.net? If so, that would be awesome, but I realize also that swfupload may not be viable if there is no one actively supporting it. The security features in Flash 10 could render some interesting unsupported challenges, and the suggestion on its page to load versions lower than 9 isn't really an option for most clients.

michaeld
Jun 21, 2013, 2:08 AM
http://www.sencha.com/forum/showthread.php?205576-File-upload-with-drag-amp-drop-support

Daniil
Jun 21, 2013, 4:42 AM
Is SwfUpload being considered to be part of a future version of ext.net? If so, that would be awesome, but I realize also that swfupload may not be viable if there is no one actively supporting it. The security features in Flash 10 could render some interesting unsupported challenges, and the suggestion on its page to load versions lower than 9 isn't really an option for most clients.

Yes, it would be cool. Currently, it is partially implemented, but no time frame for now when it finally is finished.


http://www.sencha.com/forum/showthread.php?205576-File-upload-with-drag-amp-drop-support

Yes, drag&drop files onto browsers is a nice feature, but there is the same problem in IE. As far as I can know even IE9 doesn't support it. IE10 should support.

michaeld
Jun 21, 2013, 10:58 AM
Yes, it would be cool. Currently, it is partially implemented, but no time frame for now when it finally is finished.


Holding breath...


Yes, drag&drop files onto browsers is a nice feature, but there is the same problem in IE. As far as I can know even IE9 doesn't support it. IE10 should support.

I don't mind if IE9 doesn't support it if IE10 does. Ultimately the browser can be detected and the best options can be provided based on what's available. So for instance, IE9 would get a button to select files, and IE10 would have a drag drop zone in addition. :)

I don't need this feature yet but I will need something by the end of the year.

Daniil
Jun 25, 2013, 4:56 AM
Vladimir has committed a beta version of SwfUploader. An example is here:

trunk\Ext.Net.Examples\Examples\SwfUploader\Basic\ Simple\Default.aspx

We would appreciate any feedback (for example, bug reports). It would be best to start new threads.

JCarlosF
Jun 25, 2013, 10:20 PM
Vladimir has committed a beta version of SwfUploader. An example is here:

trunk\Ext.Net.Examples\Examples\SwfUploader\Basic\ Simple\Default.aspx

We would appreciate any feedback (for example, bug reports). It would be best to start new threads.

sorry, how can i access to the example? is link ok ?

ViDom
Jun 25, 2013, 10:24 PM
sorry, how can i access to the example? is link ok ?

download newest version of Ext.Net from trunk repository. It will be in folder where you synchronize it.

Baidaly
Jun 26, 2013, 1:07 AM
Hello!

You should update from the trunk: http://svn.ext.net/premium/trunk

Then you can find the example in the trunk folder: /trunk/Ext.Net.Examples/Examples/SwfUploader/Basic/Simple/Default.aspx . Absolute path in the SVN: http://svn.ext.net/premium/trunk/Ext.Net.Examples/Examples/SwfUploader/Basic/Simple/Default.aspx

michaeld
Jul 04, 2013, 7:55 AM
I realize you have it in the trunk but is there anywhere online I can look at this new component without having to build it?

Daniil
Jul 04, 2013, 9:02 AM
Not yet. It will be available online with the next release.

hujq
Jul 05, 2013, 4:25 AM
hi:
ext.net team! I hava impliment the selected many files by the javascript ,but i can't upload the flies which is selected by the javascript,please help me!

Daniil
Jul 05, 2013, 4:52 AM
Hi @hujq,

We could look at a test case.

hujq
Jul 05, 2013, 8:46 AM
Hi @hujq,

We could look at a test case.



<%@ Page Language="C#" AutoEventWireup="true" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void UploadClick(object sender, DirectEventArgs e)
{
if (Request.Files.Count > 0)
{
//Files received


var filesReceivedAllKey = Request.Files.AllKeys;
var filesReceived = Request.Files.Keys;
if (FileUploadField1.HasFile)
{
for (int i = 0; i < filesReceived.Count; i++)
{
string aa = filesReceivedAllKey[i];
string filePath = "~/UploadFile/" + i.ToString();
//((FileUploadField)FindControl(filesReceivedAllKey[i].ToString())).PostedFile.SaveAs(MapPath(filePath)) ;
FileUploadField1.PostedFile.SaveAs(MapPath(filePat h));

}
}
}
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script type="text/javascript">


var UpdateUploadInfo = function (el, label) {


// debugger;
var ret = true;


if (Ext.isIE) {
return;
}
var size = 0;
var names = '';
for (var num1 = 0; num1 < el.files.length; num1++) {
var file = el.files[num1];
names += file.name + '\r\n';
//alert(file.name+" "+file.type+" "+file.size);
size += file.size;
}
var txt = '';
var fileSize = Ext.util.Format.fileSize(size);


if (size > 31457280) {
txt = Ext.String.format('You are trying to upload {0}. Max. allowed upload size is 30 MB', fileSize);
ret = false;
} else {
txt = Ext.String.format('{0} file(s) of total size {1}', el.files.length, fileSize);
}


label.setText(txt);
return ret;
}


var SetMultipleUpload = function (fileupload, label) {
fileupload.fileInputEl.set({ multiple: 'multiple' });


if (Ext.isIE) {
label.setText('IE does not support multiple file upload, to use this feature use Firefox or Chrome');
}
}
</script>
<title></title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<form id="form1" runat="server">
<ext:Window ID="MainWindow" runat="server" Height="260" Width="390" Layout="FitLayout"
Collapsible="true" Title="Upload files">
<Items>
<ext:FormPanel ID="BasicForm" runat="server" Frame="true" MonitorValid="true" DefaultAnchor="100%">
<Items>
<ext:FileUploadField ID="FileUploadField1" runat="server" ButtonText="Add Files"
Icon="Add" ButtonOnly="true" AllowBlank="false">
<Listeners>
<Render Handler="SetMultipleUpload( this, #{UpdateLabel}) ;" />
<Change Handler="if(!UpdateUploadInfo(this.fileInputEl.dom, #{UpdateLabel})) {this.reset();SetMultipleUpload( this, #{UpdateLabel})}" />
</Listeners>
</ext:FileUploadField>
<ext:Label ID="UpdateLabel" runat="server">
</ext:Label>
</Items>
<Listeners>
<ValidityChange Handler="#{SaveButton}.setDisabled(!valid);" />
</Listeners>
<Buttons>
<ext:Button ID="SaveButton" runat="server" Text="Save">
<DirectEvents>
<Click OnEvent="UploadClick">
<EventMask ShowMask="true" />
</Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="Button2" runat="server" Text="Reset">
<Listeners>
<Click Handler="#{BasicForm}.getForm().reset(); SetMultipleUpload( #{FileUploadField1}, #{UpdateLabel});#{UpdateLabel}.setText('');" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
<Listeners>
<Hide Handler="#{BasicForm}.getForm().reset(); SetMultipleUpload( #{FileUploadField1}, #{UpdateLabel});#{UpdateLabel}.setText('');" />
</Listeners>
</ext:Window>
</form>
</body>
</html>

Daniil
Aug 01, 2013, 7:59 AM
I think you should get the files directly from Request.Files, not from a FileUploadFied.

However, your example seems don't allow me to choose several files. When I pick up the second file it still says "1 file(s) ..." and actually uploads a single file.

Daniil
Oct 02, 2013, 4:51 PM
SwfUploader has been renamed to MultiUpload. So, it will appear in the v2.3 release as MultiUpload.