Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

techo.tony

Upload de vários arquivos com SAFileUp

Recommended Posts

Precisei mudar o site de um de meus clientes para a locaweb, e tive que mudar algumas coisas. Agora só falta o upload de arquivos, onde eles me sugeriram SAFileUpload.Já fiz o código, porém só faz o upload de 1 arquivo, quando na verdade tem que ser 4.alguém tem um tópico deste SAFileUpload com vários uploads ? Obrigado,

Compartilhar este post


Link para o post
Compartilhar em outros sites

Valew pessoal, consegui descobrir sozinho ...

 

se alguem precisar, lá vai ...

 

<%'--- DeclarationsDim oFileUp'--- Instantiate the FileUp objectSet oFileUp = Server.CreateObject("SoftArtisans.FileUp")'--- Set the Path property to the location you wish to'--- temporarily cache the incoming file before saving'--- Note: This property must be set immediately after'--- instantiating the FileUp objectoFileUp.Path = Server.MapPath(Application("vroot") & "/fotos")'--- Save the first file'--- Check to be sure there was a file selected in the form'--- If so, continue processingIf IsObject(oFileUp.Form("txt_foto01")) ThenIf Not oFileUp.Form("txt_foto01").IsEmpty Then'--- Save the file'--- Note: The Save() method saves the file'--- with its original name to the directory'--- you set as the Path property.'--- To save a file to a different location'--- or with a different name, use the SaveAs() method'--- instead of Save()On Error Resume NextoFileUp.Form("txt_foto01").SaveIf Err.Number <> 0 ThenResponse.Write "<B>An error occurred while saving the first file</B><BR>" & _Err.Description & " (" & Err.Source & ")"Response.EndEnd IfOn Error Goto 0'--- The file is saved, display a confirmation messageResponse.Write "<B>First file saved successfully on the server as: </B>"'--- The ServerName() property is the full path of the file'--- where it was saved on the serverResponse.Write oFileUp.Form("txt_foto01").ServerName & "<BR>"ElseResponse.Write "Error: There was no file submitted for upload in the first field.<BR>"End IfElseResponse.Write "The referenced field does not exist or is not of type=""file"""End If'--- Save the second file'--- Check to be sure there was a file selected in the form'--- If so, continue processingIf IsObject(oFileUp.Form("txt_foto02")) ThenIf Not oFileUp.Form("txt_foto02").IsEmpty Then'--- Save the file'--- Note: The Save() method saves the file'--- with its original name to the directory'--- you set as the Path property.'--- To save a file to a different location'--- or with a different name, use the SaveAs() method'--- instead of Save()On Error Resume NextoFileUp.Form("txt_foto02").SaveIf Err.Number <> 0 ThenResponse.Write "<B>An error occurred while saving the second file</B><BR>" & _Err.Description & " (" & Err.Source & ")"Response.EndEnd IfOn Error Goto 0'--- The file is saved, display a confirmation messageResponse.Write "<B>Second file saved successfully on the server as:</B> "'--- The ServerName() property is the full path of the file'--- where it was saved on the serverResponse.Write oFileUp.Form("txt_foto02").ServerNameElseResponse.Write "Error: There was no file submitted for upload in the second field."End IfElseResponse.Write "The referenced field does not exist or is not of type=""file"""End If'--- Destroy objectsSet oFileUp = Nothing%>

Pode fazer um loop pra muitos arqs ...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.