1
I have a Fileupload that I select several files and I save in the directory, but I realized that his Filebytes, repeats equally in all files.
if (FileUp.HasFiles)
{
foreach (HttpPostedFile uploadedFile in FileUp.PostedFiles)
{
Arquivo arq = new Arquivo();
ArquivoVersao arqVersao = new ArquivoVersao();
//seta as propriedades de arquivo
arq.XARQUIVO = Path.GetFileName(uploadedFile.FileName);
arq.EXTENSAO = Path.GetExtension(uploadedFile.FileName);
arq.ARQUIVOBYTE = FileUp.FileBytes;
FileUp.SaveAs(Server.MapPath("~/db_arquivos/") + arq.XARQUIVO);
}
}
aspx:
<div class="modal fade open" id="myModal" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" >
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">
<asp:Label ID="lblModalTitle" runat="server" Text="Enviar arquivos"></asp:Label></h4>
</div>
<div class="modal-body">
<asp:FileUpload ID="FileUp" AllowMultiple="true" runat="server" />
<br />
<input type="text" class="form-control" id="tokenfield" value="red,green,blue" />
</div>
<div class="modal-footer">
<asp:Button runat="server" CssClass="btn ui-icon-cancel small" ID="UpluodButton" OnClick="UploadButton_Click" Text="Enviar" />
</div>
</div>
</div>
</div>
My fileUpload is shot here:
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
The name, extension, etc always comes right, however Filebytes always gets the size of the first file,.
Could you please put all the code?
– PauloHDSousa
@War-lock You should be searching for the size of the uploadedFile object not?
– Julio Borges
yes, but Upluodfile does not exist fileBytes, only in Fileup, I found strange tbm.
– War Lock
I edited............
– War Lock
postei, has update panel, but not in fileuplod, Fileupload is in a modal.
– War Lock