<% response.buffer=true %> <% ' Dim s ' s = "" ' s = ScriptEngine & " Version " ' s = s & ScriptEngineMajorVersion & "." ' s = s & ScriptEngineMinorVersion & "." ' s = s & ScriptEngineBuildVersion ' response.write s ' RESPONSE.END %> Curriculumns - Soft RC <% '************************************* Funcion para cambiar el nombre al archivo ************** Function cambiar_nombre(archivo_original,este_folder_variable,letras) directorio_final = server.MapPath(".") & este_folder_variable ' esto es grabar el archivo subido abajo del directorio actual en este_folder_variable x = revisar(directorio_final) If x = "1" then Response.write "Se creó un directorio especialmente para ti....." Else Response.write " " End if Randomize anio = year(date()) mes = month(date()) dia = day(date()) if len(mes) = 1 then mes = "0" & mes end if if len(dia) = 1 then dia = "0" & dia end if cadena_variable = year(date()) & mes & dia & " " & time() & " " & Nom 'response.write cadena_variable 'response.end cadena_variable=replace(cadena_variable,"/" ,"_") cadena_variable=replace(cadena_variable,":" ," ") temp = directorio_final & archivo_original temp2 = temp caracteres_a_agregar = letras ' caracteres_a_agregar es la cantidad de caracteres que se agregaran al inicio del nombre del archivo original For i = 1 to caracteres_a_agregar cadena_variable = cadena_variable & chr(int(Rnd * 26) + 65) '65 es el ASCII para la "A" Next ' temp = cadena_variable & "-" & temp 'asi queda el archivo modificado temp = directorio_final & cadena_variable & "-" & archivo_original 'asi queda el archivo modificado ' ahora se verificara que el "nuevo archivo" exista o no, si existe se vuelve a ejecutar este fun Dim fso, msg Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists(temp)) Then cambiar_nombre(temp2) ' aqui se manda de vuelta a "randomizar" el nombre porque ya existe Else cambiar_nombre = temp ' aqui se regresa el nombre del archivo ya modificado y verificado que es unico exit function End If End Function '************************************* Fin de funcion para cambiar el nombre al archivo ************** %> <% '*************************************************** revisar que exista un directorio, si no, que lo haga Function revisar(folder) Dim fso, msg,f Set fso = CreateObject("Scripting.FileSystemObject") If not (fso.FolderExists(folder)) Then Set f = fso.CreateFolder(folder) revisar = "1" Else revisar = "0" End If End Function %>

Envío del Currículum Vitae

<% 'response.buffer=true Func = Request("Func") if isempty(Func) then Func = 2 end if limite_de_tamano = 300000 'cada uno de los archivos no puede medir mas de 300 kb limite_de_tamano_texto = limite_de_tamano/1000 'response.write Request.querystring("Nombre") Nom = Request.querystring("Nombre") if isempty(Nom) then ' Si Nom esta vacio es porque entra por primera vez a la pagina Func = 1 end if Select case Func case 1 %>

Ingrese su nombre y apellido...



<% case 2 'You do not need to use this form to send your files. 'However you should not give your submit button a NAME or ID. 'response.write request.form("nombre") nombre = request.form("nombre") 'response.write nombre %>

Hola <%response.write nombre%>, seleccione el documento que desea enviar.

Clickee en [Browse...] para buscar el archivo en su PC.

Luego clickee en el botón [Enviar Archivo].

<% Response.write "Existe un limite de " & limite_de_tamano_texto & " Kb para el archivo a enviar..." %>

Archivo... 

NOTA: Por favor sea paciente, Ud. recibirá una notificación cuando el archivo este completamente transferido.
<% case 3 ForWriting = 2 adLongVarChar = 201 lngNumberUploaded = 0 ' limite_de_tamano = 300000 'cada uno de los archivos no puede medir mas de 300 kb ' limite_de_tamano_texto = limite_de_tamano/1000 caracteres_a_agregar = 5 ' cantidad de letras que agreraran al inicio del nombre del archivo este_folder_variable = "\archivos-subidos\" 'este es un folder abajo de la pagina actual donde se grabaran los archivos ' extensiones1 = ".jpg" ' extensiones2 = ".gif" ' extensiones3 = ".doc" ' extensiones4 = ".ppt" ' extensiones5 = ".xls" ' extensiones6 = ".zip" Response.write " " %>
<% Response.write "Existe un limite de " & limite_de_tamano_texto & " Kb para el archivo a enviar..." & "
" %>
<% ' Response.write "Se agregaran " & caracteres_a_agregar & " caracteres al inicio del nombre de los archivos renombrados..." & "
" ' Response.write "Los archivos se grabaran en " & este_folder_variable & " que estara abajo de esta pagina..." & "
" ' Response.write "Solo se puede enviar un archivo con extensión " & extensiones1 & extensiones2 & extensiones3 & extensiones4 & extensiones5 & extensiones6 & "
" ' response.write "
" 'Get binary data from form noBytes = Request.TotalBytes binData = Request.BinaryRead (noBytes) 'convery the binary data to a string Set RST = CreateObject("ADODB.Recordset") LenBinary = LenB(binData) if LenBinary > 0 then RST.Fields.Append "myBinary", adLongVarChar, LenBinary RST.Open RST.AddNew RST("myBinary").AppendChunk BinData RST.Update strDataWhole = RST("myBinary") End If 'get the boundry indicator strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE") lngBoundryPos = instr(1,strBoundry,"boundary=") + 8 strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos) 'Get first file boundry positions. lngCurrentBegin = instr(1,strDataWhole,strBoundry) lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1 '******************************************* do while lngCurrentEnd > 0 'Get the data between current boundry and remove it from the whole. strData = mid(strDataWhole,lngCurrentBegin, lngCurrentEnd - lngCurrentBegin) strDataWhole = replace(strDataWhole,strData,"") 'Get the full path of the current file. lngBeginFileName = instr(1,strdata,"filename=") + 10 lngEndFileName = instr(lngBeginFileName,strData,chr(34)) 'Make sure they selected at least one file. if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 then Response.Write "

Ocurrió un error

" Response.Write "Debe seleccionar un archivo para enviar..." Response.Write "

Presione el boton Atras, seleccione el archivo y reenvíelo." Response.Write "

" Response.End end if 'There could be one or more empty file boxes. if lngBeginFileName <> lngEndFileName then strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName) 'Loose the path information and keep just the file name. tmpLng = instr(1,strFilename,"\") do while tmpLng > 0 PrevPos = tmpLng tmpLng = instr(PrevPos + 1,strFilename,"\") loop FileName = right(strFilename,len(strFileName) - PrevPos) este_folder_variable = "\archivos-subidos\" 'este es un folder abajo de la pagina actual 'response.write FileName 'Verifico el Tipo de Archivo que desean enviarnos. if instr(filename,".")<>0 then extension=mid(filename,instr(filename,".")) 'response.write extension if trim(extension)=".exe" or trim(extension)=".com" or trim(extension)=".bat" or trim(extension)=".js" or trim(extension)=".reg" or trim(extension)=".dll" or trim(extension)=".vbs" or trim(extension)=".xls" or trim(extension)=".gif" or trim(extension)=".jpg" or trim(extension)=".bmp" then %>
<% response.end %>
<% response.write "La extensión del archivo es incorrecta.

"%>
<% response.write "No aceptamos este Tipo de Archivo.

"%>
<% Response.Write "

" %>

<% end if end if 'response.end FileName = cambiar_nombre(Filename,este_folder_variable,caracteres_a_agregar) 'aqui es donde se le cambia el nombre al archivo ' y se regresa con la ruta ya dentro de este_folder_variable Filename2 = Filename tmpLng = instr(1,Filename2,"\") ' ahora obtendres solo el nombre del archivo originado do while tmpLng > 0 ' esto es solo es para hacer el link en la pagina PrevPos = tmpLng ' asi que puedes borrar esta parte tmpLng = instr(PrevPos + 1,FileName2,"\") loop FileName3 = right(FileName2,len(FileName2) - PrevPos) este_folder_variable_inverso = "archivos-subidos/" 'Get the begining position of the file data sent. 'if the file type is registered with the browser then there will be a Content-Type lngCT = instr(1,strData,"Content-Type:") if lngCT > 0 then lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4 else lngBeginPos = lngEndFileName end if 'Get the ending position of the file data sent. lngEndPos = len(strData) 'Calculate the file size. lngDataLenth = lngEndPos - lngBeginPos tamano = lngDatalenth If tamano < limite_de_tamano then %> <% 'Get the file data strFileData = mid(strData,lngBeginPos,lngDataLenth) 'Create the file. Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(FileName, ForWriting, True) f.Write strFileData set f = nothing set fso = nothing lngNumberUploaded = lngNumberUploaded + 1 'Get then next boundry postitions if any. Else%>
<%Response.write "El archivo es demasiado grande (mas de 300 Kb) y no se ha enviado..."%> El archivo tiene: <%=lngDatalenth%> Bytes
<% End if End if lngCurrentBegin = instr(1,strDataWhole,strBoundry) lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1 loop if lngNumberUploaded = 1 then 'Response.Write "

File(s) Uploaded

" %>
<% Response.Write "El archivo se envió correctamente
" %>
El archivo enviado tiene: <%=lngDatalenth%> Bytes
<% end if 'Response.Write lngNumberUploaded & " files have been uploaded.
" %>
<% Response.Write "

" %>
<% End select %>