Ir para conteúdo

POWERED BY:

Arquivado

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

Evandro Sousa

FreeAspUpload... =(

Recommended Posts

Bom dia pessoal,

Eu estou com um grande problema e preciso resolver isso bem rápido eu adoraria que vcs pudessem me ajudar.

O problema é resgatar valores no FreeAspUpload, tenho os seguintes campos, Titulo, Descricao, Grupo(COMBO) e o Arquivo, eu gostaria de poder resgatar os valores do Titulo, Descricao e Grupo, porém nao funciona o Request.Form e eu tentei de diversas maneiras e nao consegui vi muitos tópicos aqui no forúm sobre isso porém nao consegui fazer funcionar.

Tentei usar o Upload.Form("nome_do_campo") pq Uploado = New FreeAspUpload, mas mesmo assim nao veio nada.. vou mandar meu código.

 

<%@ Language=VBScript %><% 	'option explicit 	Response.Expires = -1	Server.ScriptTimeout = 600	Set UploadRequest = CreateObject("Scripting.Dictionary")%><%	' ****************************************************	' Caminho do arquivo	  Dim uploadsDirVar	  uploadsDirVar = "C:\inetpub\wwwroot\cat\arquivos" 	' ****************************************************		function OutputForm()		response.buffer=true		%>			<div class="cont">				<table border="0" cellspacing="0" cellpadding="0" width="100%">				<!--  onSubmitForm();   onclick="validaUpload();"  -->					  <form name="frmSend" method="POST" enctype="multipart/form-data" action="uploadTester.asp" onSubmit="onSubmitForm();">					<tr>						<td align="center">							<table border="0" cellspacing="0" cellpadding="0" width="400">								<tr>									<td colspan="3" align="center" class="TituloUpload"><b>Upload de Arquivos</b></td>								</tr>																<tr>									<td colspan="3" height="5"></td>								</tr>																<tr>									<td class="TextoUpload">Titulo:</td>									<td colspan="2"><input type="text" name="txtTitulo" size=35></td>								</tr>															<tr>									<td colspan="2" height="5"></td>								</tr>									<tr valign="top">									<td class="TextoUpload">Descrição:</td>									<td colspan="2"><textarea name="txtDescricao" rows="3" cols="34"></textarea></td>								</tr>									<tr>									<td colspan="3" height="5"></td>								</tr>																																<tr>									<td class="TextoUpload">Arquivo:</td>									<td colspan="2"><input name="attach1" type="file" size=35></td>								</tr>								<tr>									<td colspan="3" height="5"></td>								</tr>																	<tr>									<td class="TextoUpload">Grupo:</td>									<td colspan="2">										<select name="cboGrupo">											<option value="Teste">Teste</option>										</select>									</td>								</tr>								<tr>									<td colspan="3" height="5"></td>								</tr>																	<tr>									<td class="TextoUpload">Sub Grupo:</td>									<td colspan="2">										<select name="cboSubGrupo">											<option value="Teste">Teste</option>										</select>									</td>								</tr>								<tr>									<td colspan="3" height="5"></td>								</tr>																	<tr>									<td align="center"> </td>									<td colspan="2"><input style="margin-top:4" type="submit" name="cmdUpload" value="Upload"></td>								</tr>																	</table>						</td>					</tr>					</form>				</table>			</div>		<%	end function		function TestEnvironment()		Dim fso, fileName, testFile, streamTest		TestEnvironment = ""		Set fso = Server.CreateObject("Scripting.FileSystemObject")		if not fso.FolderExists(uploadsDirVar) then			TestEnvironment = "<B>Folder " & uploadsDirVar & " does not exist.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."		exit function		end if		fileName = uploadsDirVar & "\test.txt"		on error resume next		Set testFile = fso.CreateTextFile(fileName, true)		If Err.Number<>0 then			TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."			exit function		end if		Err.Clear		testFile.Close		fso.DeleteFile(fileName)		If Err.Number<>0 then			TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have delete permissions</B>, although it does have write permissions.<br>Change the permissions for IUSR_<I>computername</I> on this folder."			exit function		end if		Err.Clear		Set streamTest = Server.CreateObject("ADODB.Stream")		If Err.Number<>0 then			TestEnvironment = "<B>The ADODB object <I>Stream</I> is not available in your server.</B><br>Check the Requirements page for information about upgrading your ADODB libraries."			exit function		end if		Set streamTest = Nothing	end function	function SaveFiles		Dim Upload, fileName, fileSize, ks, i, fileKey		Set Upload = New FreeASPUpload		Upload.Save(uploadsDirVar)		' If something fails inside the script, but the exception is handled		If Err.Number<>0 then Exit function		SaveFiles = ""		ks = Upload.UploadedFiles.keys		if (UBound(ks) <> -1) then			SaveFiles = "<B>Files uploaded:</B> "			for each fileKey in Upload.UploadedFiles.keys				SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "			next		else			SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."		end if		SaveFiles = SaveFiles & "<br>Enter a number = " & Upload.Form("enter_a_number") & "<br>"		SaveFiles = SaveFiles & "Checkbox values = " & Upload.Form("checkbox_values") & "<br>"	end function	%><HTML>	<HEAD>		<style>			BODY {background-color: white;font-family:arial; font-size:12}		</style>		<script>			function onSubmitForm() {				var formDOMObj = document.frmSend;				if (formDOMObj.attach1.value == "" && formDOMObj.attach2.value == "" && formDOMObj.attach3.value == "" && formDOMObj.attach4.value == "" )					alert("Please press the browse button and pick a file.")				else					return true;				return false;				}		</script>	</HEAD>	<BODY>		<br><br>		<%			Dim diagnostics			if Request.ServerVariables("REQUEST_METHOD") <> "POST" then				diagnostics = TestEnvironment()				if diagnostics <> "" then					response.write "<div style=""margin-left:20; margin-top:30; margin-right:30; margin-bottom:30;"">"					response.write diagnostics					response.write "<p>After you correct this problem, reload the page."					response.write "</div>"				else					OutputForm()				end if			else				response.write Titulo & "teste"				OutputForm()				response.write SaveFiles()			end if		%>	</BODY></HTML>

Espero que possam me ajudar..

Muito Obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

Opa, beleza? Bom.. eu naum li o script inteiro, mas me parece que você tá usando FSO aê, e naum FreeAspUpload, mas como eu disse.. naum li tudo, eheh, bom, pra pegar os valores do formulario, tenta assim:

 

titulo = UploadRequest.Item("Titulo").Item("Value")

E assim por diante..

 

Flw! http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

Eu consegui,,xDbrigadao meu velho..acabei usando um outro script facil..ele utiliza uma classe d upload..abraços

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.