-
gnuzim
-
-
-
Joined on 02-02-2011
-
-
Posts 9
-
-
|
Re: Need help Object required: 'jfile'
I tried the new version already. I hope im not missing nothing! Thanks ajax-multiplefiles-handler2.asp - <!-- #include file="include_aspuploader.asp" -->
-
- <%
- Dim uploader,mvcfile
- Set uploader=new AspUploader
-
- Set fso=CreateObject("Scripting.FileSystemObject")
- savefolder=Server.MapPath("upld")
-
- If Request.Form("guidlist")&""<>"" Then
- Dim list,i
- list=Split(Request.Form("guidlist"),"/")
- Response.Write("[")
- For i=0 to Ubound(list)
-
- if i>0 then
- Response.Write(",")
- end if
-
- Set mvcfile=uploader.GetUploadedFile(list(i))
- if fso.FileExists(savefolder&"\"& day(date())&month(date())&hour(time())&replace(tratarChr2(mvcfile.FileName)," ","_"))<>true then
-
- fso.MoveFile mvcfile.FilePath,savefolder & "\" & day(date())&month(date())&hour(time())&replace(tratarChr2(mvcfile.FileName)," ","_")
-
- if(titulo = "") then
- x = split(replace(replace(mvcfile.FileName,"_"," "),"'",""),".")
- for v = 0 to ubound(x)
- ar = ar + 1
- next
- if(ar > 0) then
- titulo = replace(mvcfile.FileName,"_"," ")
- else
- titulo = x(0)
- end if
- end if
-
-
- cat = ucase(right(mvcfile.FileName,3))
- SELECT CASE cat
- CASE "JPEG", "JPG", "GIF", "PNG"
- cat = "Imagem"
- CASE "ZIP","RAR"
- cat = "Compactado"
- CASE "DOC","PDF","DOCX","TXT","RTF"
- cat = "Documento"
- CASE "EXE"
- cat = "Aplicativo"
- CASE "MP3","WAV"
- cat = "Música"
- CASE "AVI","MPEG","MPG","MP4","WMV","RM","RMVB","MKV","MOV","ASF","FLV"
- cat = "Vídeo"
- end select
-
- sql = "INSERT INTO files(uid,titulo,file,rate,size,cat,show,data,hr,ip)VALUES("&Session("id")&",'"&replace(titulo,"'","")&"','"&day(date())&month(date())&hour(time())&replace(tratarChr2(mvcfile.FileName)," ","_")&"',0,'"&formatNumber(mvcfile.FileSize/1000/1000,2)&"','"&cat&"',1,'"&date()&"','"&time()&"','"&Request.ServerVariables("REMOTE_ADDR")&"')"
- conexao.execute(sql)
- end if
- Response.Write("{")
- Response.Write("FileGuid:'ee'")
- Response.Write(",")
- Response.Write("FileSize:'aa'")
- Response.Write(",")
- Response.Write("FileName:'"&mvcfile.FileName&"'")
- Response.Write("}")
-
- Next
- Response.Write("]")
- End If
-
- Response.End()
- %>
compartilhar.asp - <!-- #include file="include_aspuploader.asp" -->
- <script type="text/javascript">
- var handlerurl=
- </script>
- <script type="text/javascript">
- function CuteWebUI_AjaxUploader_OnPostback()
- {
- var uploader = document.getElementById("myuploader");
- var guidlist = uploader.value;
-
- //Send Request
- var xh;
- if (window.XMLHttpRequest)
- xh = new window.XMLHttpRequest();
- else
- xh = new ActiveXObject("Microsoft.XMLHTTP");
-
- xh.open("POST", handlerurl, false, null, null);
- xh.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
- xh.send("guidlist=" + guidlist);
-
- //call uploader to clear the client state
- uploader.reset();
-
- if (xh.status != 200)
- {
- alert("http error " + xh.status);
- setTimeout(function() { document.write(xh.responseText); }, 10);
- return;
- }
-
- var filelist = document.getElementById("filelist");
-
- var list = eval(xh.responseText); //get JSON objects
- //Process Result:
- for (var i = 0; i < list.length; i++)
- {
- var item = list[i];
- var msg = "Enviado: " + list[i].FileName;
- var li = document.createElement("li");
- li.innerHTML = msg;
- filelist.appendChild(li);
- }
- }
- </script>
-
- <form id="form1" method="POST" onSubmit="return false" style="<%=disp%>">
- <%
- Dim uploader
- Set uploader=new AspUploader
- uploader.MaxSizeKB=2014000
- uploader.Name="myuploader"
- uploader.MultipleFilesUpload=true
- uploader.InsertText="Selecione o(s) arquivo(s)"
- uploader.AllowedFileExtensions="jpeg,jpg,gif,png,zip,doc,exe,pdf,rar,mp3,wave"
- %>
- <table align="
- <td colspan="2" align="center">
- <%=uploader.Render()%><br/>
- <div id="filelist"></div>
- </td>
- </table>
-
-
- </form>
|
|